diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2016-08-10 08:11:47 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-07-07 23:22:21 +0900 |
commit | 452a814cf014a6fbd33c380b8f7c13b03edaa531 (patch) | |
tree | 4ad91d605cb995935e32b9be1fbfb3ab3fdb26e3 /activerecord/lib/active_record | |
parent | c9b514cd3e8fe7d74ae91ecd30db839132e7899c (diff) | |
download | rails-452a814cf014a6fbd33c380b8f7c13b03edaa531.tar.gz rails-452a814cf014a6fbd33c380b8f7c13b03edaa531.tar.bz2 rails-452a814cf014a6fbd33c380b8f7c13b03edaa531.zip |
Make preload query to preparable
Currently preload query cannot be prepared statements even if
`prepared_statements: true` due to array handler in predicate builder
doesn't support making bind params. This makes preload query to
preparable by don't passing array value if possible.
Diffstat (limited to 'activerecord/lib/active_record')
-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 85343040db..1a74561c5a 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 |