aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/relations/aggregation.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/arel/relations/aggregation.rb')
-rw-r--r--lib/arel/relations/aggregation.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/arel/relations/aggregation.rb b/lib/arel/relations/aggregation.rb
index 9a34ea5d89..7e9cdfe612 100644
--- a/lib/arel/relations/aggregation.rb
+++ b/lib/arel/relations/aggregation.rb
@@ -11,13 +11,17 @@ module Arel
end
def table_sql(formatter = Sql::TableReference.new(relation))
- relation.to_sql(formatter)
+ formatter.select relation.select_sql, self
end
def attributes
@attributes ||= relation.attributes.collect(&:to_attribute).collect { |a| a.bind(self) }
end
+ def name
+ relation.name + '_aggregation'
+ end
+
def ==(other)
Aggregation === other and
self.relation == other.relation