Module: Switchman::Arel::Visitors::ToSql

Defined in:
lib/switchman/arel.rb

Instance Method Summary collapse

Instance Method Details

#quote_local_table_name(name) ⇒ Object

rubocop:enable Naming/MethodName



31
32
33
34
35
# File 'lib/switchman/arel.rb', line 31

def quote_local_table_name(name)
  return name if ::Arel::Nodes::SqlLiteral === name

  @connection.quote_local_table_name(name)
end

#visit_Arel_Attributes_Attribute(*args) ⇒ Object



22
23
24
25
26
27
# File 'lib/switchman/arel.rb', line 22

def visit_Arel_Attributes_Attribute(*args)
  o = args.first
  join_name = o.relation.table_alias || o.relation.name
  result = "#{quote_local_table_name join_name}.#{quote_column_name o.name}"
  args.last << result
end

#visit_Arel_Nodes_TableAlias(*args) ⇒ Object

rubocop:disable Naming/MethodName



15
16
17
18
19
20
# File 'lib/switchman/arel.rb', line 15

def visit_Arel_Nodes_TableAlias(*args)
  o, collector = args
  collector = visit o.relation, collector
  collector << ' '
  collector << quote_local_table_name(o.name)
end