From 430d88b37632a3c91dd6c02eb2b19863207d1cae Mon Sep 17 00:00:00 2001 From: Paul Sadauskas Date: Fri, 21 Jan 2011 17:43:01 -0700 Subject: WITH expr as array in visitor --- lib/arel/select_manager.rb | 3 +-- lib/arel/visitors/to_sql.rb | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'lib') 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 -- cgit v1.2.3