diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-05-08 23:10:04 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-05-08 23:34:24 -0300 |
commit | 84c69a165380d4ae92322d4503a5b9a7201f6369 (patch) | |
tree | 5e7f480b843afa86fa18df1d554d5c1bdbce1367 /activerecord/lib/active_record/relation/calculations.rb | |
parent | c910388587220e962682b0b9187e79b8f1641c17 (diff) | |
download | rails-84c69a165380d4ae92322d4503a5b9a7201f6369.tar.gz rails-84c69a165380d4ae92322d4503a5b9a7201f6369.tar.bz2 rails-84c69a165380d4ae92322d4503a5b9a7201f6369.zip |
Revert "Merge pull request #8209 from senny/backport_8176"
This reverts commit 724020278480855bddfe749c91f1074d4f50f3c6, reversing
changes made to e4e2bcce75b85fb8c1c49509a17bd5dfe6034c32.
Conflicts:
activerecord/CHANGELOG.md
activerecord/lib/active_record/relation/calculations.rb
activerecord/test/cases/calculations_test.rb
Reason: This caused a regression since it changed the behavior in a
stable release.
Fixes #9777
Diffstat (limited to 'activerecord/lib/active_record/relation/calculations.rb')
-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 |