diff options
author | Jon Moss <me@jonathanmoss.me> | 2016-02-01 21:16:07 -0500 |
---|---|---|
committer | Jon Moss <me@jonathanmoss.me> | 2016-02-01 21:49:13 -0500 |
commit | c918a3a0691d54f0702c26aac3f47e9449fd2a24 (patch) | |
tree | 4c7ef70de7c13e3d6dd0f5ce07fafc49d50534e7 /activesupport/lib/active_support | |
parent | 538bce1f7c676f4a5b3d800ed0f68ec065776a7f (diff) | |
download | rails-c918a3a0691d54f0702c26aac3f47e9449fd2a24.tar.gz rails-c918a3a0691d54f0702c26aac3f47e9449fd2a24.tar.bz2 rails-c918a3a0691d54f0702c26aac3f47e9449fd2a24.zip |
Fix regression in `Hash#dig` for HashWithIndifferentAccess.
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/hash_with_indifferent_access.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/hash_with_indifferent_access.rb b/activesupport/lib/active_support/hash_with_indifferent_access.rb index b878f31e75..03770a197c 100644 --- a/activesupport/lib/active_support/hash_with_indifferent_access.rb +++ b/activesupport/lib/active_support/hash_with_indifferent_access.rb @@ -69,9 +69,13 @@ module ActiveSupport end def default(*args) - key = args.first - args[0] = key.to_s if key.is_a?(Symbol) - super(*args) + arg_key = args.first + + if include?(key = convert_key(arg_key)) + self[key] + else + super + end end def self.new_from_hash_copying_default(hash) |