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

Defined in:
lib/switchman/arel.rb

Instance Method Summary collapse

Instance Method Details

#quote_local_table_name(name) ⇒ Object



27
28
29
30
# File 'lib/switchman/arel.rb', line 27

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



19
20
21
22
23
24
25
# File 'lib/switchman/arel.rb', line 19

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}"
  result = args.last << result
  result
end

#visit_Arel_Nodes_TableAlias(*args) ⇒ Object



12
13
14
15
16
17
# File 'lib/switchman/arel.rb', line 12

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