class Arel::Table
:nodoc: all
def [](name, table = self)
def [](name, table = self) name = name.to_s if name.is_a?(Symbol) name = @klass.attribute_aliases[name] || name if @klass Attribute.new(table, name) end
def able_to_type_cast?
def able_to_type_cast? !type_caster.nil? end
def alias(name = "#{self.name}_2")
def alias(name = "#{self.name}_2") Nodes::TableAlias.new(self, name) end
def eql?(other)
def eql?(other) self.class == other.class && self.name == other.name && self.table_alias == other.table_alias end
def from
def from SelectManager.new(self) end
def group(*columns)
def group(*columns) from.group(*columns) end
def hash
def hash # Perf note: aliases and table alias is excluded from the hash # aliases can have a loop back to this table breaking hashes in parent # relations, for the vast majority of cases @name is unique to a query @name.hash end
def having(expr)
def having(expr) from.having expr end
def initialize(name, as: nil, klass: nil, type_caster: klass&.type_caster)
def initialize(name, as: nil, klass: nil, type_caster: klass&.type_caster) @name = name.to_s @klass = klass @type_caster = type_caster # Sometime AR sends an :as parameter to table, to let the table know # that it is an Alias. We may want to override new, and return a # TableAlias node? if as.to_s == @name as = nil end @table_alias = as end
def join(relation, klass = Nodes::InnerJoin)
def join(relation, klass = Nodes::InnerJoin) return from unless relation case relation when String, Nodes::SqlLiteral raise EmptyJoinError if relation.empty? klass = Nodes::StringJoin end from.join(relation, klass) end
def order(*expr)
def order(*expr) from.order(*expr) end
def outer_join(relation)
def outer_join(relation) join(relation, Nodes::OuterJoin) end
def project(*things)
def project(*things) from.project(*things) end
def skip(amount)
def skip(amount) from.skip amount end
def take(amount)
def take(amount) from.take amount end
def type_cast_for_database(attr_name, value)
def type_cast_for_database(attr_name, value) type_caster.type_cast_for_database(attr_name, value) end
def type_for_attribute(name)
def type_for_attribute(name) type_caster.type_for_attribute(name) end
def where(condition)
def where(condition) from.where condition end