1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/lib/arel/nodes/table_alias.rb
2018-02-24 18:11:47 +10:30

27 lines
591 B
Ruby

# frozen_string_literal: true
module Arel # :nodoc: all
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 type_cast_for_database(*args)
relation.type_cast_for_database(*args)
end
def able_to_type_cast?
relation.respond_to?(:able_to_type_cast?) && relation.able_to_type_cast?
end
end
end
end