File tree Expand file tree Collapse file tree 2 files changed +4
-6
lines changed
lib/active_record/relation Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -252,9 +252,6 @@ def select(*fields)
252
252
def _select! ( *fields ) # :nodoc:
253
253
fields . reject! ( &:blank? )
254
254
fields . flatten!
255
- fields . map! do |field |
256
- klass . attribute_alias? ( field ) ? klass . attribute_alias ( field ) . to_sym : field
257
- end
258
255
self . select_values += fields
259
256
self
260
257
end
@@ -1164,9 +1161,9 @@ def arel_columns(columns)
1164
1161
case field
1165
1162
when Symbol
1166
1163
field = field . to_s
1167
- arel_column ( field ) { connection . quote_table_name ( field ) }
1164
+ arel_column ( field , & connection . method ( :quote_table_name ) )
1168
1165
when String
1169
- arel_column ( field ) { field }
1166
+ arel_column ( field , & :itself )
1170
1167
when Proc
1171
1168
field . call
1172
1169
else
@@ -1182,7 +1179,7 @@ def arel_column(field)
1182
1179
if klass . columns_hash . key? ( field ) && ( !from || table_name_matches? ( from ) )
1183
1180
arel_attribute ( field )
1184
1181
else
1185
- yield
1182
+ yield field
1186
1183
end
1187
1184
end
1188
1185
Original file line number Diff line number Diff line change @@ -292,6 +292,7 @@ def test_selecting_aliased_attribute_quotes_column_name_when_from_is_used
292
292
klass . create! ( description : "foo" )
293
293
294
294
assert_equal [ "foo" ] , klass . select ( :description ) . from ( klass . all ) . map ( &:desc )
295
+ assert_equal [ "foo" ] , klass . reselect ( :description ) . from ( klass . all ) . map ( &:desc )
295
296
end
296
297
297
298
def test_relation_merging_with_merged_joins_as_strings
You can’t perform that action at this time.
0 commit comments