Permalink
Browse files

Add ToSql NilClass visitor

  • Loading branch information...
1 parent 01e7cee commit afb6f9c5c1de606c10eca6967010eaa4bfde263b @ernie ernie committed with tenderlove Nov 3, 2010
Showing with 5 additions and 0 deletions.
  1. +1 −0 lib/arel/visitors/to_sql.rb
  2. +4 −0 test/visitors/test_to_sql.rb
@@ -277,6 +277,7 @@ def visit_String o; quote(o, @last_column) end
alias :visit_Symbol :visit_String
alias :visit_Time :visit_String
alias :visit_TrueClass :visit_String
+ alias :visit_NilClass :visit_String
def quote value, column = nil
@connection.quote value, column
@@ -45,6 +45,10 @@ module Visitors
@visitor.accept Date.today
end
+ it "should visit_NilClass" do
+ @visitor.accept(nil).must_be_like "NULL"
+ end
+
it "should visit_Arel_Nodes_And" do
node = Nodes::And.new @attr.eq(10), @attr.eq(11)
@visitor.accept(node).must_be_like %{

0 comments on commit afb6f9c

Please sign in to comment.