Permalink
Browse files

attributes should be constructed with table objects

  • Loading branch information...
1 parent 442e4d0 commit 9a28d42d6001fbcb94e955d7b9c1655001d5c05c @tenderlove tenderlove committed Sep 7, 2010
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/relation/calculations.rb
View
2 activerecord/lib/active_record/relation/calculations.rb
@@ -186,7 +186,7 @@ def perform_calculation(operation, column_name, options = {})
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

0 comments on commit 9a28d42

Please sign in to comment.