aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPaul Sadauskas <psadauskas@gmail.com>2011-01-21 17:43:01 -0700
committerPaul Sadauskas <psadauskas@gmail.com>2011-01-21 17:43:01 -0700
commit430d88b37632a3c91dd6c02eb2b19863207d1cae (patch)
tree5a7bee5c449c97387d250374c0bb57aeddb20d9c /lib
parent75bfee8cc15ca8bd07629c6e7b6f0950dcb2d864 (diff)
downloadrails-430d88b37632a3c91dd6c02eb2b19863207d1cae.tar.gz
rails-430d88b37632a3c91dd6c02eb2b19863207d1cae.tar.bz2
rails-430d88b37632a3c91dd6c02eb2b19863207d1cae.zip
WITH expr as array in visitor
Diffstat (limited to 'lib')
-rw-r--r--lib/arel/select_manager.rb3
-rw-r--r--lib/arel/visitors/to_sql.rb4
2 files changed, 3 insertions, 4 deletions
diff --git a/lib/arel/select_manager.rb b/lib/arel/select_manager.rb
index 22e3dd07e0..8f5995e32c 100644
--- a/lib/arel/select_manager.rb
+++ b/lib/arel/select_manager.rb
@@ -151,10 +151,9 @@ module Arel
else
node_class = Nodes::With
end
- @ast.with = node_class.new(*subqueries)
+ @ast.with = node_class.new(subqueries.flatten)
end
-
def take limit
@ast.limit = Nodes::Limit.new(limit)
@ctx.top = Nodes::Top.new(limit)
diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb
index 37c6a533ed..e021b5a707 100644
--- a/lib/arel/visitors/to_sql.rb
+++ b/lib/arel/visitors/to_sql.rb
@@ -151,11 +151,11 @@ eowarn
end
def visit_Arel_Nodes_With o
- "WITH #{visit o.children}"
+ "WITH #{o.children.map { |x| visit x }.join(', ')}"
end
def visit_Arel_Nodes_WithRecursive o
- "WITH RECURSIVE #{visit o.children}"
+ "WITH RECURSIVE #{o.children.map { |x| visit x }.join(', ')}"
end
def visit_Arel_Nodes_Union o