Skip to content
Browse files

avoid an inject in favor of dup

  • Loading branch information...
1 parent 9a28d42 commit 1276c2833629a4088113ca8bc992a374e0f59728 @tenderlove tenderlove committed Sep 8, 2010
Showing with 3 additions and 3 deletions.
  1. +3 −3 activerecord/lib/active_record/base.rb
View
6 activerecord/lib/active_record/base.rb
@@ -1100,9 +1100,9 @@ def with_scope(method_scoping = {}, action = :merge, &block)
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 ])

0 comments on commit 1276c28

Please sign in to comment.
Something went wrong with that request. Please try again.