diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-04-29 10:05:40 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-04-29 10:05:40 -0700 |
commit | 490d6f98f8974c717ddca29df162f5f1ad48e094 (patch) | |
tree | e8bc316708d8c2478c62e1aa2055d7f0a598da51 /lib | |
parent | dd07005dceb6641214f7d1166f75acbd379fb570 (diff) | |
parent | fe5719fea54468f0ebcc97060df6958db17303de (diff) | |
download | rails-490d6f98f8974c717ddca29df162f5f1ad48e094.tar.gz rails-490d6f98f8974c717ddca29df162f5f1ad48e094.tar.bz2 rails-490d6f98f8974c717ddca29df162f5f1ad48e094.zip |
Merged pull request #40 from gmile/master.
Passing nil in array generates improper SQL
Diffstat (limited to 'lib')
-rw-r--r-- | lib/arel/predications.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/arel/predications.rb b/lib/arel/predications.rb index 08cbf16d9d..36eae074a8 100644 --- a/lib/arel/predications.rb +++ b/lib/arel/predications.rb @@ -42,7 +42,17 @@ module Arel Nodes::Between.new(self, Nodes::And.new([other.begin, other.end])) end else - Nodes::In.new self, other + if other.include?(nil) + if other.size > 1 + set = Nodes::In.new self, other.compact + null = Nodes::Equality.new self, nil + Nodes::Or.new set, null + else + Nodes::Equality.new self, nil + end + else + Nodes::In.new self, other + end end end |