diff options
author | Yves Senn <yves.senn@gmail.com> | 2013-08-03 13:30:00 -0700 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2013-08-03 13:30:00 -0700 |
commit | fc2d79b6e259e62cc4eac8343e23ba777cb9a1b4 (patch) | |
tree | 5c057c29898584239fa34cf1e57972eaab7b97d5 | |
parent | 50029ba5a125477b9a0cc17af4c474ddf8a61cae (diff) | |
parent | 1d0a306b571125ca12d012caa68080da56afe906 (diff) | |
download | rails-fc2d79b6e259e62cc4eac8343e23ba777cb9a1b4.tar.gz rails-fc2d79b6e259e62cc4eac8343e23ba777cb9a1b4.tar.bz2 rails-fc2d79b6e259e62cc4eac8343e23ba777cb9a1b4.zip |
Merge pull request #11730 from neerajdotname/use_flat_map
use flat_map
-rw-r--r-- | activerecord/lib/active_record/associations/preloader/association.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/preloader/association.rb b/activerecord/lib/active_record/associations/preloader/association.rb index d31f7432cd..0cc836f991 100644 --- a/activerecord/lib/active_record/associations/preloader/association.rb +++ b/activerecord/lib/active_record/associations/preloader/association.rb @@ -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 |