Skip to content

Commit 06da26a

Browse files
Merge pull request rails#48556 from skipkayhil/hm-fix-encrypted-config-hash
Fix EncryptedConfiguration not behaving like Hash
2 parents 7a033f5 + 8355658 commit 06da26a

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

activesupport/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
* Fix `EncryptedConfiguration` returning incorrect values for some `Hash`
2+
methods
3+
4+
*Hartley McGuire*
5+
16
* Don't show secrets for `MessageEncryptor#inspect`.
27

38
Before:

activesupport/lib/active_support/encrypted_configuration.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def deep_transform(hash)
9292
end
9393

9494
def options
95-
@options ||= ActiveSupport::InheritableOptions.new(deep_transform(config))
95+
@options ||= deep_transform(config)
9696
end
9797

9898
def deserialize(content)

activesupport/test/encrypted_configuration_test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class EncryptedConfigurationTest < ActiveSupport::TestCase
4545
assert_not @credentials.something.bad
4646
assert_equal "bar", @credentials.dig(:something, :nested, :foo)
4747
assert_equal "bar", @credentials.something.nested.foo
48+
assert_equal [:something], @credentials.keys
4849
assert_equal [:good, :bad, :nested], @credentials.something.keys
4950
assert_equal ({ good: true, bad: false, nested: { foo: "bar" } }), @credentials.something
5051
end

0 commit comments

Comments
 (0)