aboutsummaryrefslogtreecommitdiffstats
path: root/lib/active_relation/relations/compound.rb
blob: 776620732d8f6cbd54d0ec9dfeaf93eeda8f29d7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
module ActiveRelation
  class Compound < Relation
    attr_reader :relation
    delegate :joins, :selects, :orders, :groupings, :table_sql, :inserts, :limit,
             :offset, :name, :alias, :aggregation?, :prefix_for, :aliased_prefix_for,
             :to => :relation
    
    def attributes
      relation.attributes.collect { |a| a.substitute(self) }
    end
    
    protected
    def attribute_for_name(name)
      relation[name].substitute(self) rescue nil
    end
  end
end