diff options
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/relation/calculations.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb index 1f9dbdc3d4..71d33fcd4e 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -183,9 +183,8 @@ module ActiveRecord column_name = column_name.to_s end - relation = clone - relation.select_values = [column_name] - klass.connection.select_all(relation.arel).map! do |attributes| + column_name = column_name.to_s + klass.connection.select_all(select(column_name).arel).map! do |attributes| klass.type_cast_attribute(attributes.keys.first, klass.initialize_attributes(attributes)) end end |