提交 13aa1e11 编写于 作者: A Aaron Patterson

converting an inject to a map + Hash[]

上级 61bacc4a
......@@ -230,7 +230,7 @@ def construct_limited_ids_condition(relation)
end
def find_by_attributes(match, attributes, *args)
conditions = attributes.inject({}) {|h, a| h[a] = args[attributes.index(a)]; h}
conditions = Hash[attributes.map {|a| [a, args[attributes.index(a)]]}]
result = where(conditions).send(match.finder)
if match.bang? && result.blank?
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册