Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Changeset [0a79eb7889e7ac711ff171a453d65f3df57b9237] by jamie

Revision 0a79eb7889e7ac711ff171a453d65f3df57b9237, committed by jamie · January 7th, 2010 @ 06:23 PM

Add validates method as shortcut to setup validators for a given set of attributes:

class Person < ActiveRecord::Base
include MyValidators

validates :name, :presence => true, :uniqueness => true, :length => { :maximum => 100 } validates :email, :presence => true, :email => true end

[#3058 status:resolved]

Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/0a79eb7889e7ac711ff171a453d65f...

17 changed files

  • A activemodel/lib/active_model/validations/validates.rb
  • A activemodel/test/cases/validations/validates_test.rb
  • A activemodel/test/models/person_with_validator.rb
  • A activemodel/test/validators/email_validator.rb
  • M activemodel/lib/active_model/validations.rb
  • M activemodel/lib/active_model/validations/acceptance.rb
  • M activemodel/lib/active_model/validations/confirmation.rb
  • M activemodel/lib/active_model/validations/exclusion.rb
  • M activemodel/lib/active_model/validations/format.rb
  • M activemodel/lib/active_model/validations/inclusion.rb
  • M activemodel/lib/active_model/validations/length.rb
  • M activemodel/lib/active_model/validations/numericality.rb
  • M activemodel/lib/active_model/validations/presence.rb
  • M activemodel/lib/active_model/validations/with.rb
  • M activemodel/lib/active_model/validator.rb
  • M activemodel/test/cases/validations/with_validation_test.rb
  • M activemodel/test/models/custom_reader.rb