Permalink
Browse files

removing an inject + merge in favor of Hash#[]

  • Loading branch information...
1 parent 6059c96 commit c493624fc2e20002c0b3418f1497eddffc35417e @tenderlove tenderlove committed Sep 28, 2010
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/relation/calculations.rb
@@ -222,7 +222,7 @@ def execute_grouped_calculation(operation, column_name) #:nodoc:
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|

0 comments on commit c493624

Please sign in to comment.