diff options
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/relation/calculations.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb index 86b89c741d..0b3d1ed3ff 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -215,7 +215,8 @@ module ActiveRecord select_statement << "#{group_field} AS #{group_alias}" - relation = except(:group).select(select_statement).group(group) + relation = except(:group).group(group) + relation.select_values = select_statement calculated_data = @klass.connection.select_all(relation.to_sql) |