aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-10-31 00:23:47 -0200
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-12-18 08:35:03 -0200
commit73fb6349c98742bb404bd7ad97184d19f32a8366 (patch)
tree600fdc1f2c180ed9955fe4986f6791e8de37967e /activerecord
parentaf0582968dfb400375bbef6ace7166aac1041f3d (diff)
downloadrails-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.rb5
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