aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/arel/visitors/to_sql.rb2
-rw-r--r--test/visitors/test_to_sql.rb5
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb
index 22f7943ab9..28c4bd8bfa 100644
--- a/lib/arel/visitors/to_sql.rb
+++ b/lib/arel/visitors/to_sql.rb
@@ -715,7 +715,7 @@ module Arel
quote(o, column_for(a))
end
- def unsupported o
+ def unsupported o, collector
raise "unsupported: #{o.class.name}"
end
diff --git a/test/visitors/test_to_sql.rb b/test/visitors/test_to_sql.rb
index 05e75b5e0d..65d36bc004 100644
--- a/test/visitors/test_to_sql.rb
+++ b/test/visitors/test_to_sql.rb
@@ -247,6 +247,11 @@ module Arel
compile(Nodes.build_quoted(nil)).must_be_like "NULL"
end
+ it "unsupported input should not raise ArgumentError" do
+ error = assert_raises(RuntimeError) { compile(nil) }
+ assert_match /\Aunsupported/, error.message
+ end
+
it "should visit_Arel_SelectManager, which is a subquery" do
mgr = Table.new(:foo).project(:bar)
compile(mgr).must_be_like '(SELECT bar FROM "foo")'