Skip to content
This repository
Browse code

avoid an inject in favor of dup

  • Loading branch information...
commit 1276c2833629a4088113ca8bc992a374e0f59728 1 parent 9a28d42
Aaron Patterson tenderlove authored

Showing 1 changed file with 3 additions and 3 deletions. Show diff stats Hide diff stats

  1. +3 3 activerecord/lib/active_record/base.rb
6 activerecord/lib/active_record/base.rb
@@ -1100,9 +1100,9 @@ def with_scope(method_scoping = {}, action = :merge, &block)
1100 1100
1101 1101 if method_scoping.is_a?(Hash)
1102 1102 # Dup first and second level of hash (method and params).
1103   - method_scoping = method_scoping.inject({}) do |hash, (method, params)|
1104   - hash[method] = (params == true) ? params : params.dup
1105   - hash
  1103 + method_scoping = method_scoping.dup
  1104 + method_scoping.each do |method, params|
  1105 + method_scoping[method] = params.dup unless params == true
1106 1106 end
1107 1107
1108 1108 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.