aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/relations/alias.rb
blob: 0099a794b436964670028b2e5fac6385ba87c6d5 (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
module Arel
  class Alias < Compound
    def initialize(relation)
      @relation = relation
    end
    
    def ==(other)
      equal? other
    end
    
    def table
      self
    end
    
    def relation_for(attribute)
      self[attribute] and self
    end
    
    def table_sql(formatter = Sql::TableReference.new(self))
      formatter.table self
    end
    
  end
end