diff options
author | José Valim <jose.valim@gmail.com> | 2010-11-26 11:55:56 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-11-26 11:56:52 +0100 |
commit | ce9456eca0c4ea77a42aaad5e8080842c1c01422 (patch) | |
tree | e9ce376e848e1be07060cc4e8430a2f9cd7bded9 /activesupport/lib | |
parent | 9332cc582ebaa9b6755fa7bdfe0bc04dd51c098d (diff) | |
download | rails-ce9456eca0c4ea77a42aaad5e8080842c1c01422.tar.gz rails-ce9456eca0c4ea77a42aaad5e8080842c1c01422.tar.bz2 rails-ce9456eca0c4ea77a42aaad5e8080842c1c01422.zip |
Only convert direct hash instances in hash with indifferent access.
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/hash_with_indifferent_access.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/hash_with_indifferent_access.rb b/activesupport/lib/active_support/hash_with_indifferent_access.rb index 320f5c1c92..6a344867ee 100644 --- a/activesupport/lib/active_support/hash_with_indifferent_access.rb +++ b/activesupport/lib/active_support/hash_with_indifferent_access.rb @@ -140,11 +140,10 @@ module ActiveSupport end def convert_value(value) - case value - when Hash + if value.class == Hash self.class.new_from_hash_copying_default(value) - when Array - value.dup.replace(value.collect { |e| e.is_a?(Hash) ? self.class.new_from_hash_copying_default(e) : e }) + elsif value.is_a?(Array) + value.dup.replace(value.map { |e| convert_value(e) }) else value end |