aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/relations/compound.rb
blob: f8af1906448a75a1f4a5614398fcaf26191a7cab (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
26
module Arel
  class Compound < Relation
    attr_reader :relation
    hash_on :relation
    delegate :joins, :selects, :join?, :orders, :groupings, :inserts, :taken,
             :skipped, :name, :aggregation?, :column_for,
             :engine, :table, :table_sql,
             :to => :relation
    
    def attributes
      @attributes ||= relation.attributes.collect { |a| a.bind(self) }
    end
    
    def selects
      @selects ||= relation.selects.collect { |s| s.bind(self) }
    end
    
    def groupings
      @groupings ||= relation.groupings.collect { |g| g.bind(self) }
    end
    
    def orders
      @orders ||= relation.orders.collect { |o| o.bind(self) }
    end
  end
end