From a5d894ce566a21ec4c5db9df06be7f22a1690691 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 7 Sep 2010 16:47:10 -0700 Subject: attributes should be constructed with table objects --- activerecord/lib/active_record/relation/calculations.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb index 077398c28a..a80ac40a2c 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -186,7 +186,7 @@ module ActiveRecord def execute_simple_calculation(operation, column_name, distinct) #:nodoc: column = if @klass.column_names.include?(column_name.to_s) - Arel::Attribute.new(@klass.unscoped, column_name) + Arel::Attribute.new(@klass.unscoped.table, column_name) else Arel::SqlLiteral.new(column_name == :all ? "*" : column_name.to_s) end -- cgit v1.2.3