1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

use flat_map

This commit is contained in:
Neeraj Singh 2013-08-03 15:14:14 +05:30
parent 71f512646a
commit 1d0a306b57

View file

@ -77,7 +77,7 @@ module ActiveRecord
# 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