Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Adds visit_Arel_Nodes_InfixOperation to Arel::Visitors::DepthFirst #112

Merged
merged 1 commit into from

2 participants

Benedikt Deicke Aaron Patterson
Benedikt Deicke

This pull requests adds an alias for visit_Arel_Nodes_InfixOperation to Arel::Visitors::DepthFirst.

Without this alias there will be a NoMethodError which will mess up the Arel::Visitors::Visitor::DISPATCH in some situations (like Model.some_scope.count in ActiveRecord). As a result subsequent tree traversals involving Arel::Nodes::InfixOperation will fail, too.

Aaron Patterson tenderlove merged commit b454667 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
1  lib/arel/visitors/depth_first.rb
View
@@ -70,6 +70,7 @@ def binary o
alias :visit_Arel_Nodes_GreaterThan :binary
alias :visit_Arel_Nodes_GreaterThanOrEqual :binary
alias :visit_Arel_Nodes_In :binary
+ alias :visit_Arel_Nodes_InfixOperation :binary
alias :visit_Arel_Nodes_JoinSource :binary
alias :visit_Arel_Nodes_InnerJoin :binary
alias :visit_Arel_Nodes_LessThan :binary
6 test/visitors/test_depth_first.rb
View
@@ -114,6 +114,12 @@ def test_outer_join
end
end
+ def test_Arel_Nodes_InfixOperation
+ binary = Arel::Nodes::InfixOperation.new(:o, :a, :b)
+ @visitor.accept binary
+ assert_equal [:a, :b, binary], @collector.calls
+ end
+
# N-ary
[
Arel::Nodes::And,
Something went wrong with that request. Please try again.