diff options
Diffstat (limited to 'activemodel/lib/active_model/validations/with.rb')
-rw-r--r-- | activemodel/lib/active_model/validations/with.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/activemodel/lib/active_model/validations/with.rb b/activemodel/lib/active_model/validations/with.rb index 65ae18a769..72b8562b93 100644 --- a/activemodel/lib/active_model/validations/with.rb +++ b/activemodel/lib/active_model/validations/with.rb @@ -32,7 +32,7 @@ module ActiveModel # class MyValidator < ActiveModel::Validator # def validate(record) # if some_complex_logic - # record.errors[:base] << "This record is invalid" + # record.errors.add :base, "This record is invalid" # end # end # @@ -56,12 +56,14 @@ module ActiveModel # if the validation should occur (e.g. <tt>:if => :allow_validation</tt>, # or <tt>:if => Proc.new { |user| user.signup_step > 2 }</tt>). # The method, proc or string should return or evaluate to a true or false value. - # * <tt>unless</tt> - Specifies a method, proc or string to call to + # * <tt>:unless</tt> - Specifies a method, proc or string to call to # determine if the validation should not occur # (e.g. <tt>:unless => :skip_validation</tt>, or # <tt>:unless => Proc.new { |user| user.signup_step <= 2 }</tt>). # The method, proc or string should return or evaluate to a true or false value. - # + # * <tt>:strict</tt> - Specifies whether validation should be strict. + # See <tt>ActiveModel::Validation#validates!</tt> for more information + # If you pass any additional configuration options, they will be passed # to the class and available as <tt>options</tt>: # @@ -101,7 +103,7 @@ module ActiveModel # class Person # include ActiveModel::Validations # - # validates :instance_validations + # validate :instance_validations # # def instance_validations # validates_with MyValidator @@ -116,7 +118,7 @@ module ActiveModel # class Person # include ActiveModel::Validations # - # validates :instance_validations, :on => :create + # validate :instance_validations, :on => :create # # def instance_validations # validates_with MyValidator, MyOtherValidator @@ -140,4 +142,4 @@ module ActiveModel end end end -end
\ No newline at end of file +end |