diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-28 10:30:42 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-28 10:30:42 -0700 |
commit | bf2223d0e0a5562fb2e946abca4289953134cb77 (patch) | |
tree | 6c4a109b78cc306cbde605efdabc71d9466e17bb /activerecord/lib/active_record/relation | |
parent | 75e52df0e8b6a229a696a28423f1a40c9837ba76 (diff) | |
download | rails-bf2223d0e0a5562fb2e946abca4289953134cb77.tar.gz rails-bf2223d0e0a5562fb2e946abca4289953134cb77.tar.bz2 rails-bf2223d0e0a5562fb2e946abca4289953134cb77.zip |
removing an inject + merge in favor of Hash#[]
Diffstat (limited to 'activerecord/lib/active_record/relation')
-rw-r--r-- | activerecord/lib/active_record/relation/calculations.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb index 12a2c6aec3..63689ed925 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -222,7 +222,7 @@ module ActiveRecord if association key_ids = calculated_data.collect { |row| row[group_alias] } key_records = association.klass.base_class.find(key_ids) - key_records = key_records.inject({}) { |hsh, r| hsh.merge(r.id => r) } + key_records = Hash[key_records.map { |r| [r.id, r] }] end ActiveSupport::OrderedHash[calculated_data.map do |row| |