aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/arel/visitors/depth_first.rb9
-rw-r--r--test/visitors/test_depth_first.rb18
2 files changed, 27 insertions, 0 deletions
diff --git a/lib/arel/visitors/depth_first.rb b/lib/arel/visitors/depth_first.rb
index 8ff4b4d162..5c89ef96b3 100644
--- a/lib/arel/visitors/depth_first.rb
+++ b/lib/arel/visitors/depth_first.rb
@@ -61,6 +61,15 @@ module Arel
alias :visit_Time :terminal
alias :visit_TrueClass :terminal
+ def visit_Arel_Nodes_SelectCore o
+ visit o.projections
+ visit o.froms
+ visit o.wheres
+ visit o.groups
+ visit o.having
+ @block.call o
+ end
+
def visit_Arel_Nodes_UpdateStatement o
visit o.relation
visit o.values
diff --git a/test/visitors/test_depth_first.rb b/test/visitors/test_depth_first.rb
index fd91dd5fb9..a318583e26 100644
--- a/test/visitors/test_depth_first.rb
+++ b/test/visitors/test_depth_first.rb
@@ -84,6 +84,24 @@ module Arel
assert_equal [:a, :b, stmt.values, :c, stmt.wheres, :d, stmt.orders,
:e, stmt], @collector.calls
end
+
+ def test_select_core
+ core = Nodes::SelectCore.new
+ core.projections << :a
+ core.froms = :b
+ core.wheres << :c
+ core.groups << :d
+ core.having = :e
+
+ @visitor.accept core
+ assert_equal [
+ :a, core.projections,
+ :b,
+ :c, core.wheres,
+ :d, core.groups,
+ :e,
+ core], @collector.calls
+ end
end
end
end