diff options
Diffstat (limited to 'activesupport/lib/active_support/core_ext/hash/indifferent_access.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/hash/indifferent_access.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb b/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb index 6c7e6d76ac..01d5b3a6a3 100644 --- a/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb +++ b/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb @@ -73,8 +73,16 @@ class HashWithIndifferentAccess < Hash def convert_key(key) key.kind_of?(Symbol) ? key.to_s : key end + def convert_value(value) - value.is_a?(Hash) ? value.with_indifferent_access : value + case value + when Hash + value.with_indifferent_access + when Array + value.collect { |e| e.is_a?(Hash) ? e.with_indifferent_access : e } + else + value + end end end |