Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit c493624fc2e20002c0b3418f1497eddffc35417e 1 parent 6059c96
@tenderlove tenderlove authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  activerecord/lib/active_record/relation/calculations.rb
View
2  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|
Please sign in to comment.
Something went wrong with that request. Please try again.