converting an inject to a map + Hash[]

This commit is contained in:
Aaron Patterson 2010-09-10 15:23:00 -07:00
parent 61bacc4ada
commit 13aa1e11a0

@ -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?