Class: ActiveRecord::Associations::JoinDependency::Aliases::Table

Inherits:
Struct
  • Object
show all
Defined in:
activerecord/lib/active_record/associations/join_dependency.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Struct

#as_json, #to_h

Instance Attribute Details

#columnsObject

Returns the value of attribute columns

Returns:

  • (Object)

    the current value of columns


35
36
37
# File 'activerecord/lib/active_record/associations/join_dependency.rb', line 35

def columns
  @columns
end

#nodeObject

Returns the value of attribute node

Returns:

  • (Object)

    the current value of node


35
36
37
# File 'activerecord/lib/active_record/associations/join_dependency.rb', line 35

def node
  @node
end

Instance Method Details

#column_aliasesObject


40
41
42
43
# File 'activerecord/lib/active_record/associations/join_dependency.rb', line 40

def column_aliases
  t = table
  columns.map { |column| t[column.name].as Arel.sql column.alias }
end

#tableObject


36
37
38
# File 'activerecord/lib/active_record/associations/join_dependency.rb', line 36

def table
  Arel::Nodes::TableAlias.new node.table, node.aliased_table_name
end