diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-10-14 16:39:57 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-10-14 16:39:57 -0700 |
commit | 2eee8af4d058b60323b60dd1a56c247e485c0835 (patch) | |
tree | beb6bc9e3a88cfc5117095184943a874d37957ef /activerecord/lib/active_record/associations | |
parent | b59d47d82e6ecb4308b675875b5a62c79858645e (diff) | |
download | rails-2eee8af4d058b60323b60dd1a56c247e485c0835.tar.gz rails-2eee8af4d058b60323b60dd1a56c247e485c0835.tar.bz2 rails-2eee8af4d058b60323b60dd1a56c247e485c0835.zip |
make sure cache is not used for collection assocations too
follow up for #17052
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r-- | activerecord/lib/active_record/associations/collection_association.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb index 1836ff0910..bdfd569be2 100644 --- a/activerecord/lib/active_record/associations/collection_association.rb +++ b/activerecord/lib/active_record/associations/collection_association.rb @@ -407,7 +407,12 @@ module ActiveRecord private def get_records - return scope.to_a if reflection.scope_chain.any?(&:any?) || scope.eager_loading? + if reflection.scope_chain.any?(&:any?) || + scope.eager_loading? || + klass.current_scope + + return scope.to_a + end conn = klass.connection sc = reflection.association_scope_cache(conn, owner) do |