diff options
-rw-r--r-- | History.txt | 6 | ||||
-rw-r--r-- | lib/arel/visitors/visitor.rb | 1 | ||||
-rw-r--r-- | test/visitors/test_depth_first.rb | 7 |
3 files changed, 14 insertions, 0 deletions
diff --git a/History.txt b/History.txt index 3676246f37..fa08015903 100644 --- a/History.txt +++ b/History.txt @@ -1,3 +1,9 @@ +== 2.0.6 12/01/2010 + +* Bug Fixes + + * Rails 3.0.x does not like that Node is Enumerable, so removing for now. + == 2.0.5 11/30/2010 * Enhancements diff --git a/lib/arel/visitors/visitor.rb b/lib/arel/visitors/visitor.rb index 8cea42028e..055acf9765 100644 --- a/lib/arel/visitors/visitor.rb +++ b/lib/arel/visitors/visitor.rb @@ -18,6 +18,7 @@ module Arel superklass = object.class.ancestors.find { |klass| respond_to?(DISPATCH[klass], true) } + raise(TypeError, "Cannot visit #{object.class}") unless superklass DISPATCH[object.class] = DISPATCH[superklass] retry end diff --git a/test/visitors/test_depth_first.rb b/test/visitors/test_depth_first.rb index 4015d72254..1bee0328cf 100644 --- a/test/visitors/test_depth_first.rb +++ b/test/visitors/test_depth_first.rb @@ -14,6 +14,13 @@ module Arel @visitor = Visitors::DepthFirst.new @collector end + def test_raises_with_object + assert_raises(TypeError) do + @visitor.accept(Object.new) + end + end + + # unary ops [ Arel::Nodes::Not, |