diff options
author | Yves Senn <yves.senn@gmail.com> | 2013-02-11 21:24:11 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2013-02-14 17:46:07 +0100 |
commit | 4a4ff504590adfb516502ea332ad0608652b3519 (patch) | |
tree | 55556c392e53ea5662aa2e3c110815525af33881 /activerecord/lib | |
parent | 1fd78305b5812c186d9eed9475677f90946eba5f (diff) | |
download | rails-4a4ff504590adfb516502ea332ad0608652b3519.tar.gz rails-4a4ff504590adfb516502ea332ad0608652b3519.tar.bz2 rails-4a4ff504590adfb516502ea332ad0608652b3519.zip |
don't cache invalid subsets when preloading hmt associations.
closes #8423.
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/associations/preloader/through_association.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/preloader/through_association.rb b/activerecord/lib/active_record/associations/preloader/through_association.rb index 1c1ba11c44..b0b1c13b0d 100644 --- a/activerecord/lib/active_record/associations/preloader/through_association.rb +++ b/activerecord/lib/active_record/associations/preloader/through_association.rb @@ -31,7 +31,8 @@ module ActiveRecord through_records = Array.wrap(owner.send(through_reflection.name)) # Dont cache the association - we would only be caching a subset - if reflection.options[:source_type] && through_reflection.collection? + if (through_scope != through_reflection.klass.unscoped) || + (reflection.options[:source_type] && through_reflection.collection?) owner.association(through_reflection.name).reset end |