提交 c6612172 编写于 作者: S Santiago Pastorino 提交者: GitHub

Merge pull request #26447 from kamipo/reduce_array_allocation

Reduce array allocation when `where` with passed hash
......@@ -7,8 +7,6 @@ def initialize(klass, predicate_builder)
end
def build(opts, other)
binds = []
case opts
when String, Array
parts = [klass.send(:sanitize_sql, other.empty? ? opts : ([opts] + other))]
......@@ -26,7 +24,7 @@ def build(opts, other)
raise ArgumentError, "Unsupported argument type: #{opts} (#{opts.class})"
end
WhereClause.new(parts, binds)
WhereClause.new(parts, binds || [])
end
protected
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册