diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-10 15:23:00 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-10 15:28:57 -0700 |
commit | 13aa1e11a0bd5d698f7d66c4cf8e9c4ee260bc36 (patch) | |
tree | 1a18de02e48d100e2a11f116975c7b45b368dee6 | |
parent | 61bacc4adaf1ed423ef4e4ca69b6ca90075d9ec3 (diff) | |
download | rails-13aa1e11a0bd5d698f7d66c4cf8e9c4ee260bc36.tar.gz rails-13aa1e11a0bd5d698f7d66c4cf8e9c4ee260bc36.tar.bz2 rails-13aa1e11a0bd5d698f7d66c4cf8e9c4ee260bc36.zip |
converting an inject to a map + Hash[]
-rw-r--r-- | activerecord/lib/active_record/relation/finder_methods.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index 4ffb552690..ede1c8821e 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -230,7 +230,7 @@ module ActiveRecord 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? |