From d1ce45cd8c77bea3c5b7d197a66f172ffcd5e6a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Mon, 7 Sep 2015 18:19:26 -0300 Subject: Use Hash[] instead of Hash#dup in resolve_column_aliases Related with #20418 --- activerecord/lib/active_record/table_metadata.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'activerecord') 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 -- cgit v1.2.3