From 11f929b5c485adab60ea2d8b515ef2abcf5400f4 Mon Sep 17 00:00:00 2001 From: Daniel Cadenas Date: Tue, 31 May 2011 00:40:11 -0300 Subject: Add nodes for boolean constants This is useful for dynamically created predicates e.g: expr1 = table.create_false expr2 = table.create_false expr1 = create_a_predicate() if some_condition expr2 = create_another_predicate() if some_other_condition table.where(expr1.and(expr2)) --- lib/arel/visitors/to_sql.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/arel/visitors/to_sql.rb') diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb index 933edc15f2..8aec4cb147 100644 --- a/lib/arel/visitors/to_sql.rb +++ b/lib/arel/visitors/to_sql.rb @@ -90,6 +90,14 @@ key on UpdateManager using UpdateManager#key= o.alias ? " AS #{visit o.alias}" : ''}" end + def visit_Arel_Nodes_True o + "TRUE" + end + + def visit_Arel_Nodes_False o + "FALSE" + end + def table_exists? name @pool.table_exists? name end -- cgit v1.2.3