Permalink
Browse files

converting an inject to a map + Hash[]

  • Loading branch information...
tenderlove committed Sep 10, 2010
1 parent 1817ae3 commit 89cc7426dd5da4cac0b57ea40a7be17cf81e3a0e
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/relation/finder_methods.rb
@@ -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?

0 comments on commit 89cc742

Please sign in to comment.