diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-10 16:58:19 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-10 16:58:19 -0700 |
commit | f0f6b7fb90b936cb78d786896598486821db6559 (patch) | |
tree | 9a5d7d61be6e70fd4c132457dec965ee41533422 /lib/arel/visitors | |
parent | 1ba8ac0848f40c7fa18c9e7bdac944a50d3c348c (diff) | |
download | rails-f0f6b7fb90b936cb78d786896598486821db6559.tar.gz rails-f0f6b7fb90b936cb78d786896598486821db6559.tar.bz2 rails-f0f6b7fb90b936cb78d786896598486821db6559.zip |
adding not equal node, column names are expected to be symbols
Diffstat (limited to 'lib/arel/visitors')
-rw-r--r-- | lib/arel/visitors/to_sql.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb index 8638bf43c3..761f315763 100644 --- a/lib/arel/visitors/to_sql.rb +++ b/lib/arel/visitors/to_sql.rb @@ -159,7 +159,6 @@ module Arel def visit_Arel_Nodes_Equality o right = o.right - # FIXME: maybe we should visit NilClass? if right.nil? "#{visit o.left} IS NULL" else @@ -167,6 +166,16 @@ module Arel end end + def visit_Arel_Nodes_NotEqual o + right = o.right + + if right.nil? + "#{visit o.left} IS NOT NULL" + else + "#{visit o.left} != #{visit right}" + end + end + def visit_Arel_Nodes_UnqualifiedColumn o "#{quote_column_name o.name}" end |