Skip to content
Browse files

use flat_map

  • Loading branch information...
1 parent 71f5126 commit 1d0a306b571125ca12d012caa68080da56afe906 Neeraj Singh committed Aug 3, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/associations/preloader/association.rb
View
2 activerecord/lib/active_record/associations/preloader/association.rb
@@ -77,7 +77,7 @@ 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.map { |slice| records_for(slice).to_a }.flatten
+ records = sliced.flat_map { |slice| records_for(slice).to_a }
end
# Each record may have multiple owners, and vice-versa

0 comments on commit 1d0a306

Please sign in to comment.
Something went wrong with that request. Please try again.