diff options
author | Evgeniy Dolzhenko <dolzenko@gmail.com> | 2011-10-11 14:13:08 +0100 |
---|---|---|
committer | Evgeniy Dolzhenko <dolzenko@gmail.com> | 2011-10-11 14:13:08 +0100 |
commit | c317419359d9d868c4e8c12a2ba2e2f541eef3d6 (patch) | |
tree | f12d1f34873c215bdb730f1678f2cfddf4d495d5 /activemodel/lib/active_model/validations/validates.rb | |
parent | c568a9ba11d1f870a15669c8ed8d5d41283a8ad3 (diff) | |
download | rails-c317419359d9d868c4e8c12a2ba2e2f541eef3d6.tar.gz rails-c317419359d9d868c4e8c12a2ba2e2f541eef3d6.tar.bz2 rails-c317419359d9d868c4e8c12a2ba2e2f541eef3d6.zip |
Use .add instead of << to add errors
Diffstat (limited to 'activemodel/lib/active_model/validations/validates.rb')
-rw-r--r-- | activemodel/lib/active_model/validations/validates.rb | 4 |
1 files changed, 2 insertions, 2 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 # |