提交 1877cf9b 编写于 作者: A Akira Matsuda

where(foo: [1, nil]) becomes "WHERE foo = 1 OR foo IS NULL"

was "WHERE foo IN (1) OR foo IS NULL" before
上级 c8711e4e
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册