提交 9a6ed049 编写于 作者: R Rafael Mendonça França

Merge pull request #15352 from sgrif/sg-allow-empty-array-where

Allow empty arrays in where predicates
......@@ -2,6 +2,8 @@ module ActiveRecord
class PredicateBuilder
class ArrayHandler # :nodoc:
def call(attribute, value)
return attribute.in([]) if value.empty?
values = value.map { |x| x.is_a?(Base) ? x.id : x }
ranges, values = values.partition { |v| v.is_a?(Range) }
nils, values = values.partition(&:nil?)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册