diff options
author | Paul Sadauskas <psadauskas@gmail.com> | 2011-01-21 17:43:01 -0700 |
---|---|---|
committer | Paul Sadauskas <psadauskas@gmail.com> | 2011-01-21 17:43:01 -0700 |
commit | 430d88b37632a3c91dd6c02eb2b19863207d1cae (patch) | |
tree | 5a7bee5c449c97387d250374c0bb57aeddb20d9c /lib | |
parent | 75bfee8cc15ca8bd07629c6e7b6f0950dcb2d864 (diff) | |
download | rails-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.rb | 3 | ||||
-rw-r--r-- | lib/arel/visitors/to_sql.rb | 4 |
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 |