Merge pull request #40201 from Shopify/symbol-name

Use Symbol#name if available in HashWithIndifferentAccess
This commit is contained in:
Rafael França 2020-12-08 13:45:16 -05:00 committed by GitHub
commit ccefd5ce7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -365,8 +365,14 @@ module ActiveSupport
end
private
def convert_key(key)
key.kind_of?(Symbol) ? key.to_s : key
if Symbol.method_defined?(:name)
def convert_key(key)
key.kind_of?(Symbol) ? key.name : key
end
else
def convert_key(key)
key.kind_of?(Symbol) ? key.to_s : key
end
end
def convert_value(value, conversion: nil)