aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel
diff options
context:
space:
mode:
Diffstat (limited to 'lib/arel')
-rw-r--r--lib/arel/visitors/to_sql.rb14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb
index 921eeb9b91..2c460ed4ba 100644
--- a/lib/arel/visitors/to_sql.rb
+++ b/lib/arel/visitors/to_sql.rb
@@ -118,7 +118,7 @@ module Arel
collector << "INSERT INTO "
collector = visit o.relation, collector
if o.columns.any?
- collector << "(#{o.columns.map { |x|
+ collector << " (#{o.columns.map { |x|
quote_column_name x.name
}.join ', '})"
end
@@ -171,14 +171,18 @@ module Arel
@schema_cache.columns_hash(table)
end
- def visit_Arel_Nodes_Values o
- "VALUES (#{o.expressions.zip(o.columns).map { |value, attr|
+ def visit_Arel_Nodes_Values o, collector
+ collector << "VALUES ("
+
+ collector << o.expressions.zip(o.columns).map { |value, attr|
if Nodes::SqlLiteral === value
- visit value
+ value
else
quote(value, attr && column_for(attr))
end
- }.join ', '})"
+ }.join(', ')
+
+ collector << ")"
end
def visit_Arel_Nodes_SelectStatement o, collector