aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-09-07 18:19:26 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-09-07 18:19:26 -0300
commitd1ce45cd8c77bea3c5b7d197a66f172ffcd5e6a6 (patch)
treee85b44411957e7db523c02a9c341bad9c61eedea /activerecord
parent8167d18c71fff0a30c317ce226eadad1b846473b (diff)
downloadrails-d1ce45cd8c77bea3c5b7d197a66f172ffcd5e6a6.tar.gz
rails-d1ce45cd8c77bea3c5b7d197a66f172ffcd5e6a6.tar.bz2
rails-d1ce45cd8c77bea3c5b7d197a66f172ffcd5e6a6.zip
Use Hash[] instead of Hash#dup in resolve_column_aliases
Related with #20418
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/table_metadata.rb4
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