This project is archived and is in readonly mode.

Changeset [0a79eb7889e7ac711ff171a453d65f3df57b9237] 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

Committed by jamie

  • 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

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>