Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

remove extra flat_map array

  • Loading branch information...
commit 242d70278689a0f7e6c6f415992c8de0aa5caee0 1 parent 98c0853
@tenderlove tenderlove authored
View
17 activerecord/lib/active_record/associations/preloader/association.rb
@@ -82,15 +82,16 @@ def associated_records_by_owner
# Some databases impose a limit on the number of ids in a list (in Oracle it's 1000)
# Make several smaller queries if necessary or make one query if the adapter supports it
sliced = owner_keys.each_slice(klass.connection.in_clause_length || owner_keys.size)
- records = sliced.flat_map { |slice| records_for(slice) }
-
- records.each do |record|
- owner_key = owner_id_for records, record
-
- owners_map[owner_key].each do |owner|
- records_by_owner[owner] << record
+ sliced.each { |slice|
+ records = records_for(slice)
+ records.each do |record|
+ owner_key = owner_id_for records, record
+
+ owners_map[owner_key].each do |owner|
+ records_by_owner[owner] << record
+ end
end
- end
+ }
end
records_by_owner
Please sign in to comment.
Something went wrong with that request. Please try again.