aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/relations/aggregation.rb
blob: 55f24997cc793050c51a7576036f0228ef2030b9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
module Arel
  class Aggregation < Compound
    include Recursion::BaseCase

    def initialize(relation)
      @relation = relation
    end
    
    def selects
      []
    end
  
    def table_sql(formatter = Sql::TableReference.new(relation))
      relation.to_sql(formatter)
    end
  
    def attributes
      @attributes ||= relation.attributes.collect(&:to_attribute)
    end
    
    def ==(other)
      self.class == other.class and self.relation == other.relation
    end
  end
end