From 73fb6349c98742bb404bd7ad97184d19f32a8366 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Wed, 31 Oct 2012 00:23:47 -0200 Subject: Avoid unnecessary hashes with error options --- activerecord/lib/active_record/validations/uniqueness.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'activerecord/lib/active_record') 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 -- cgit v1.2.3