Method: Arel::Table#initialize

Defined in:
activerecord/lib/arel/table.rb

#initialize(name, as: nil, klass: nil, type_caster: klass&.type_caster) ⇒ Table

Returns a new instance of Table.


16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'activerecord/lib/arel/table.rb', line 16

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