attributes should be associated with tables

This commit is contained in:
Aaron Patterson
2010-09-07 16:38:49 -07:00
parent c6015cbcd8
commit 0c7a4daaa1

View File

@@ -211,7 +211,7 @@ module ActiveRecord
select_statement = if operation == 'count' && column_name == :all
"COUNT(*) AS count_all"
else
Arel::Attribute.new(@klass.unscoped, column_name).send(operation).as(aggregate_alias).to_sql
Arel::Attribute.new(@klass.unscoped.table, column_name).send(operation).as(aggregate_alias).to_sql
end
select_statement << ", #{group_field} AS #{group_alias}"