aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/visitors/to_sql.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-04-08 21:21:36 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2014-04-08 21:21:36 -0700
commitdc9b23624e5e2a6a5943f8eaef235df59d563805 (patch)
treec2ed6fe29b79f0b646b531282e9780da74898eb9 /lib/arel/visitors/to_sql.rb
parent02bf81f198a69b51a758aab96d450fafbcbc347c (diff)
downloadrails-dc9b23624e5e2a6a5943f8eaef235df59d563805.tar.gz
rails-dc9b23624e5e2a6a5943f8eaef235df59d563805.tar.bz2
rails-dc9b23624e5e2a6a5943f8eaef235df59d563805.zip
fixing test_table.rb
Diffstat (limited to 'lib/arel/visitors/to_sql.rb')
-rw-r--r--lib/arel/visitors/to_sql.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb
index ee72d864e1..921eeb9b91 100644
--- a/lib/arel/visitors/to_sql.rb
+++ b/lib/arel/visitors/to_sql.rb
@@ -114,16 +114,16 @@ module Arel
collector
end
- def visit_Arel_Nodes_InsertStatement o
- [
- "INSERT INTO #{visit o.relation}",
-
- ("(#{o.columns.map { |x|
- quote_column_name x.name
- }.join ', '})" unless o.columns.empty?),
+ def visit_Arel_Nodes_InsertStatement o, collector
+ collector << "INSERT INTO "
+ collector = visit o.relation, collector
+ if o.columns.any?
+ collector << "(#{o.columns.map { |x|
+ quote_column_name x.name
+ }.join ', '})"
+ end
- (visit o.values if o.values),
- ].compact.join ' '
+ maybe_visit o.values, collector
end
def visit_Arel_Nodes_Exists o, collector