From c0c8a04efc16d3737b3a153b1ee4f75065c3193a Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 8 Sep 2010 13:55:30 -0700 Subject: avoid an inject in favor of dup --- activerecord/lib/active_record/base.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index ef4834811c..b4d0da9f78 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1080,9 +1080,9 @@ module ActiveRecord #:nodoc: if method_scoping.is_a?(Hash) # Dup first and second level of hash (method and params). - method_scoping = method_scoping.inject({}) do |hash, (method, params)| - hash[method] = (params == true) ? params : params.dup - hash + method_scoping = method_scoping.dup + method_scoping.each do |method, params| + method_scoping[method] = params.dup unless params == true end method_scoping.assert_valid_keys([ :find, :create ]) -- cgit v1.2.3