diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2011-10-14 22:21:40 +0530 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2011-10-14 22:21:40 +0530 |
commit | e759c8882a990606bb4aee8a643431ebe544c69f (patch) | |
tree | dea32e65055a6e67d89f106cf696ae7ef358619a /activemodel | |
parent | 521a089166a17d447c3b3b32ff7f9394774ca895 (diff) | |
parent | e2a3952428050ea8a22c6a7de27f30ee0b9b1d4d (diff) | |
download | rails-e759c8882a990606bb4aee8a643431ebe544c69f.tar.gz rails-e759c8882a990606bb4aee8a643431ebe544c69f.tar.bz2 rails-e759c8882a990606bb4aee8a643431ebe544c69f.zip |
Merge branch 'master' of github.com:lifo/docrails
Diffstat (limited to 'activemodel')
-rw-r--r-- | activemodel/lib/active_model/validations/validates.rb | 4 | ||||
-rw-r--r-- | activemodel/lib/active_model/validations/with.rb | 2 | ||||
-rw-r--r-- | activemodel/lib/active_model/validator.rb | 6 |
3 files changed, 6 insertions, 6 deletions
diff --git a/activemodel/lib/active_model/validations/validates.rb b/activemodel/lib/active_model/validations/validates.rb index b85c2453fb..fbceb81e8f 100644 --- a/activemodel/lib/active_model/validations/validates.rb +++ b/activemodel/lib/active_model/validations/validates.rb @@ -27,7 +27,7 @@ module ActiveModel # # class EmailValidator < ActiveModel::EachValidator # def validate_each(record, attribute, value) - # record.errors[attribute] << (options[:message] || "is not an email") unless + # record.errors.add attribute, (options[:message] || "is not an email") unless # value =~ /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i # end # end @@ -48,7 +48,7 @@ module ActiveModel # # class TitleValidator < ActiveModel::EachValidator # def validate_each(record, attribute, value) - # record.errors[attribute] << "must start with 'the'" unless value =~ /\Athe/i + # record.errors.add attribute, "must start with 'the'" unless value =~ /\Athe/i # end # end # diff --git a/activemodel/lib/active_model/validations/with.rb b/activemodel/lib/active_model/validations/with.rb index 83aae206a6..93a340eb39 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 # diff --git a/activemodel/lib/active_model/validator.rb b/activemodel/lib/active_model/validator.rb index 5304743389..0e444738ba 100644 --- a/activemodel/lib/active_model/validator.rb +++ b/activemodel/lib/active_model/validator.rb @@ -48,8 +48,8 @@ module ActiveModel #:nodoc: # # class MyValidator < ActiveModel::Validator # def validate(record) - # record.errors[:base] << "This is some custom error message" - # record.errors[:first_name] << "This is some complex validation" + # record.errors.add :base, "This is some custom error message" + # record.errors.add :first_name, "This is some complex validation" # # etc... # end # end @@ -68,7 +68,7 @@ module ActiveModel #:nodoc: # # class TitleValidator < ActiveModel::EachValidator # def validate_each(record, attribute, value) - # record.errors[attribute] << 'must be Mr. Mrs. or Dr.' unless value.in?(['Mr.', 'Mrs.', 'Dr.']) + # record.errors.add attribute, 'must be Mr. Mrs. or Dr.' unless value.in?(['Mr.', 'Mrs.', 'Dr.']) # end # end # |