aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2019-04-09 22:38:08 +0900
committerRyuta Kamizono <kamipo@gmail.com>2019-04-09 23:11:11 +0900
commit2ab3751781e34ca4a8d477ba53ff307ae9884b0d (patch)
tree4af4ec3fcbaac314188cd307927d1dcf966d61f9 /activerecord/lib/active_record/relation
parent483d0dcb7649fc403bbad40719d82dc0a901f49e (diff)
downloadrails-2ab3751781e34ca4a8d477ba53ff307ae9884b0d.tar.gz
rails-2ab3751781e34ca4a8d477ba53ff307ae9884b0d.tar.bz2
rails-2ab3751781e34ca4a8d477ba53ff307ae9884b0d.zip
Remove duplicated attribute alias resolution in `_select!`
This is also resolved in `arel_column`.
Diffstat (limited to 'activerecord/lib/active_record/relation')
-rw-r--r--activerecord/lib/active_record/relation/query_methods.rb9
1 files changed, 3 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb
index 7ea18c3069..90b5e9a118 100644
--- a/activerecord/lib/active_record/relation/query_methods.rb
+++ b/activerecord/lib/active_record/relation/query_methods.rb
@@ -252,9 +252,6 @@ module ActiveRecord
def _select!(*fields) # :nodoc:
fields.reject!(&:blank?)
fields.flatten!
- fields.map! do |field|
- klass.attribute_alias?(field) ? klass.attribute_alias(field).to_sym : field
- end
self.select_values += fields
self
end
@@ -1164,9 +1161,9 @@ module ActiveRecord
case field
when Symbol
field = field.to_s
- arel_column(field) { connection.quote_table_name(field) }
+ arel_column(field, &connection.method(:quote_table_name))
when String
- arel_column(field) { field }
+ arel_column(field, &:itself)
when Proc
field.call
else
@@ -1182,7 +1179,7 @@ module ActiveRecord
if klass.columns_hash.key?(field) && (!from || table_name_matches?(from))
arel_attribute(field)
else
- yield
+ yield field
end
end