aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPaul Sadauskas <psadauskas@gmail.com>2011-01-21 17:40:44 -0700
committerPaul Sadauskas <psadauskas@gmail.com>2011-01-21 17:40:44 -0700
commit75bfee8cc15ca8bd07629c6e7b6f0950dcb2d864 (patch)
tree5934a9a1f1012a962ea29aff8745f0094b5a6950 /lib
parent6abed021b19d073f159f9b7e6d9f466e053f8e6b (diff)
downloadrails-75bfee8cc15ca8bd07629c6e7b6f0950dcb2d864.tar.gz
rails-75bfee8cc15ca8bd07629c6e7b6f0950dcb2d864.tar.bz2
rails-75bfee8cc15ca8bd07629c6e7b6f0950dcb2d864.zip
With node takes an array, less code to determine alternative nodes
Diffstat (limited to 'lib')
-rw-r--r--lib/arel/nodes/with.rb9
-rw-r--r--lib/arel/select_manager.rb12
2 files changed, 3 insertions, 18 deletions
diff --git a/lib/arel/nodes/with.rb b/lib/arel/nodes/with.rb
index ce1644b60e..0745080cc3 100644
--- a/lib/arel/nodes/with.rb
+++ b/lib/arel/nodes/with.rb
@@ -1,14 +1,7 @@
module Arel
module Nodes
class With < Arel::Nodes::Unary
- attr_reader :children
- alias value children
- alias expr children
-
- def initialize *children
- @children = children
- end
-
+ alias children expr
end
class WithRecursive < With; end
diff --git a/lib/arel/select_manager.rb b/lib/arel/select_manager.rb
index 4f510d096b..22e3dd07e0 100644
--- a/lib/arel/select_manager.rb
+++ b/lib/arel/select_manager.rb
@@ -136,11 +136,7 @@ module Arel
def union operation, other = nil
if operation.is_a? Symbol
- if operation === :all
- node_class = Nodes::UnionAll
- else
- raise "Only supported UNION operation is :all"
- end
+ node_class = Nodes.const_get("Union#{operation.to_s.capitalize}")
else
other = operation
node_class = Nodes::Union
@@ -151,11 +147,7 @@ module Arel
def with *subqueries
if subqueries.first.is_a? Symbol
- if subqueries.shift == :recursive
- node_class = Nodes::WithRecursive
- else
- raise "Only supported WITH modifier is :recursive"
- end
+ node_class = Nodes.const_get("With#{subqueries.shift.to_s.capitalize}")
else
node_class = Nodes::With
end