Use Hash[] instead of Hash#dup in resolve_column_aliases

Related with #20418
This commit is contained in:
Rafael Mendonça França 2015-09-07 18:19:26 -03:00
parent 8167d18c71
commit d1ce45cd8c
1 changed files with 3 additions and 1 deletions

View File

@ -10,7 +10,9 @@ module ActiveRecord
end
def resolve_column_aliases(hash)
hash = hash.dup
# This method is a hot spot, so for now, use Hash[] to dup the hash.
# https://bugs.ruby-lang.org/issues/7166
hash = Hash[hash]
hash.keys.grep(Symbol) do |key|
if klass.attribute_alias? key
hash[klass.attribute_alias(key)] = hash.delete key