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

Defined in:
lib/switchman/arel.rb

Instance Method Summary collapse

Instance Method Details

#quote_local_table_name(name) ⇒ Object



25
26
27
28
# File 'lib/switchman/arel.rb', line 25

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



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

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



10
11
12
13
14
15
# File 'lib/switchman/arel.rb', line 10

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