aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/nodes/table_alias.rb
blob: ebfcb58e640deacf7842986a578274ee924551c1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
module Arel
  module Nodes
    class TableAlias < Arel::Nodes::Binary
      alias :name :right
      alias :relation :left
      alias :table_alias :name

      def [] name
        Attribute.new(self, name)
      end

      def table_name
        relation.respond_to?(:name) ? relation.name : name
      end

      def engine
        relation.engine
      end
    end
  end
end