where(foo: [1, nil]) becomes "WHERE foo = 1 OR foo IS NULL"
was "WHERE foo IN (1) OR foo IS NULL" before
This commit is contained in:
parent
c8711e4ecd
commit
1877cf9b2a
@ -29,8 +29,11 @@ def self.build_from_hash(engine, attributes, default_table)
|
||||
|
||||
if values.include?(nil)
|
||||
values = values.compact
|
||||
if values.empty?
|
||||
case values.length
|
||||
when 0
|
||||
array_predicates << attribute.eq(nil)
|
||||
when 1
|
||||
array_predicates << attribute.eq(values.first).or(attribute.eq(nil))
|
||||
else
|
||||
array_predicates << attribute.in(values).or(attribute.eq(nil))
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user