diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-10-31 00:23:47 -0200 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-12-18 08:35:03 -0200 |
commit | 73fb6349c98742bb404bd7ad97184d19f32a8366 (patch) | |
tree | 600fdc1f2c180ed9955fe4986f6791e8de37967e /activerecord | |
parent | af0582968dfb400375bbef6ace7166aac1041f3d (diff) | |
download | rails-73fb6349c98742bb404bd7ad97184d19f32a8366.tar.gz rails-73fb6349c98742bb404bd7ad97184d19f32a8366.tar.bz2 rails-73fb6349c98742bb404bd7ad97184d19f32a8366.zip |
Avoid unnecessary hashes with error options
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/validations/uniqueness.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/validations/uniqueness.rb b/activerecord/lib/active_record/validations/uniqueness.rb index 5db17155c5..dc07645732 100644 --- a/activerecord/lib/active_record/validations/uniqueness.rb +++ b/activerecord/lib/active_record/validations/uniqueness.rb @@ -36,7 +36,10 @@ module ActiveRecord relation = relation.merge(options[:conditions]) if options[:conditions] if relation.exists? - record.errors.add(attribute, :taken, options.except(:case_sensitive, :scope, :conditions).merge(:value => value)) + error_options = options.except(:case_sensitive, :scope, :conditions) + error_options[:value] = value + + record.errors.add(attribute, :taken, error_options) end end |