diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-20 16:03:44 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-20 16:03:44 -0700 |
commit | cd13c3e1dad07c1168a318feb543d3b1ede9f2cf (patch) | |
tree | 13c42f2e2427b1d5727704a940855bd345044272 /lib/arel | |
parent | 9e5a4423cdbbe161dade56306d7c4d70f5371be2 (diff) | |
download | rails-cd13c3e1dad07c1168a318feb543d3b1ede9f2cf.tar.gz rails-cd13c3e1dad07c1168a318feb543d3b1ede9f2cf.tar.bz2 rails-cd13c3e1dad07c1168a318feb543d3b1ede9f2cf.zip |
dealing with empty in statements
Diffstat (limited to 'lib/arel')
-rw-r--r-- | lib/arel/visitors/to_sql.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb index cbe2b6cca3..5a92e27149 100644 --- a/lib/arel/visitors/to_sql.rb +++ b/lib/arel/visitors/to_sql.rb @@ -155,7 +155,9 @@ module Arel end def visit_Arel_Nodes_In o - "#{visit o.left} IN (#{o.right.map { |x| visit x }.join ', '})" + right = o.right + right = right.empty? ? 'NULL' : right.map { |x| visit x }.join(', ') + "#{visit o.left} IN (#{right})" end def visit_Arel_Nodes_And o |