aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorJohn Firebaugh <john_firebaugh@bigfix.com>2010-08-12 11:43:10 -0700
committerJosé Valim <jose.valim@gmail.com>2010-09-25 10:59:54 +0200
commit75a960ca6e38ae68fd55c034272102077fd95afa (patch)
treef91226095842303acd0bf049245fd74d38a2e258 /activemodel/lib
parent308517e913ef1e8d9f13e023bc450374b5ed780a (diff)
downloadrails-75a960ca6e38ae68fd55c034272102077fd95afa.tar.gz
rails-75a960ca6e38ae68fd55c034272102077fd95afa.tar.bz2
rails-75a960ca6e38ae68fd55c034272102077fd95afa.zip
Don't act destructively on ActiveModel::Name#human options hash. [#5366 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activemodel/lib')
-rw-r--r--activemodel/lib/active_model/naming.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/activemodel/lib/active_model/naming.rb b/activemodel/lib/active_model/naming.rb
index 0706df4b59..fc2abacb6d 100644
--- a/activemodel/lib/active_model/naming.rb
+++ b/activemodel/lib/active_model/naming.rb
@@ -1,4 +1,5 @@
require 'active_support/inflector'
+require 'active_support/core_ext/hash/except'
module ActiveModel
class Name < String
@@ -35,10 +36,10 @@ module ActiveModel
klass.model_name.i18n_key
end
- defaults << options.delete(:default) if options[:default]
+ defaults << options[:default] if options[:default]
defaults << @human
- options.reverse_merge! :scope => [@klass.i18n_scope, :models], :count => 1, :default => defaults
+ options = {:scope => [@klass.i18n_scope, :models], :count => 1, :default => defaults}.merge(options.except(:default))
I18n.translate(defaults.shift, options)
end