diff options
author | Sean Griffin <sean@seantheprogrammer.com> | 2017-07-18 15:41:02 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-18 15:41:02 -0400 |
commit | a03a7ce50b9dfe4a13f0cd11b69a093a5bcfd7e9 (patch) | |
tree | e16061820d2a896cf76d69b6574461a848096b8b /activerecord/lib/active_record/associations/preloader | |
parent | a6d6e90fa90eedbdb6d3cda679aa4b47ddfa7315 (diff) | |
parent | 452a814cf014a6fbd33c380b8f7c13b03edaa531 (diff) | |
download | rails-a03a7ce50b9dfe4a13f0cd11b69a093a5bcfd7e9.tar.gz rails-a03a7ce50b9dfe4a13f0cd11b69a093a5bcfd7e9.tar.bz2 rails-a03a7ce50b9dfe4a13f0cd11b69a093a5bcfd7e9.zip |
Merge pull request #29033 from kamipo/make_preload_query_to_prepared_statements
Make preload query to preparable
Diffstat (limited to 'activerecord/lib/active_record/associations/preloader')
-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 698fd29beb..d0964ee4fd 100644 --- a/activerecord/lib/active_record/associations/preloader/association.rb +++ b/activerecord/lib/active_record/associations/preloader/association.rb @@ -103,7 +103,7 @@ module ActiveRecord end def records_for(ids, &block) - scope.where(association_key_name => ids).load(&block) + scope.where(association_key_name => ids.size == 1 ? ids.first : ids).load(&block) end def scope |