diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-09-07 18:19:26 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-09-07 18:19:26 -0300 |
commit | d1ce45cd8c77bea3c5b7d197a66f172ffcd5e6a6 (patch) | |
tree | e85b44411957e7db523c02a9c341bad9c61eedea | |
parent | 8167d18c71fff0a30c317ce226eadad1b846473b (diff) | |
download | rails-d1ce45cd8c77bea3c5b7d197a66f172ffcd5e6a6.tar.gz rails-d1ce45cd8c77bea3c5b7d197a66f172ffcd5e6a6.tar.bz2 rails-d1ce45cd8c77bea3c5b7d197a66f172ffcd5e6a6.zip |
Use Hash[] instead of Hash#dup in resolve_column_aliases
Related with #20418
-rw-r--r-- | activerecord/lib/active_record/table_metadata.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/table_metadata.rb b/activerecord/lib/active_record/table_metadata.rb index 41f1c55c3c..702bf8a885 100644 --- a/activerecord/lib/active_record/table_metadata.rb +++ b/activerecord/lib/active_record/table_metadata.rb @@ -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 |