class Arel::Table
Attributes
Public Class Methods
Source
# File lib/arel/table.rb, line 15 def initialize(name, as: nil, type_caster: nil) @name = name.to_s @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
Public Instance Methods
Source
# File lib/arel/table.rb, line 102 def able_to_type_cast? !type_caster.nil? end
Source
# File lib/arel/table.rb, line 28 def alias name = "#{self.name}_2" Nodes::TableAlias.new(self, name) end
Source
# File lib/arel/table.rb, line 91 def eql? other self.class == other.class && self.name == other.name && self.table_alias == other.table_alias end
Also aliased as: ==
Source
# File lib/arel/table.rb, line 52 def group *columns from.group(*columns) end
Source
# File lib/arel/table.rb, line 84 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
Source
# File lib/arel/table.rb, line 36 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
Source
# File lib/arel/table.rb, line 48 def outer_join relation join(relation, Nodes::OuterJoin) end
Source
# File lib/arel/table.rb, line 64 def project *things from.project(*things) end
Source
# File lib/arel/table.rb, line 98 def type_cast_for_database(attribute_name, value) type_caster.type_cast_for_database(attribute_name, value) end
Source
# File lib/arel/table.rb, line 60 def where condition from.where condition end