aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-02-14 09:28:55 -0800
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-02-14 09:28:55 -0800
commitcdbd64d1a3afd5a08c393403da61d8c7c1ae6c72 (patch)
treeded3db6d7a1a844440d3112b4bbc1fb5af530e44 /activerecord/lib
parenta254e4b4928735da3bf62a885f8a2ff8915d8a3e (diff)
parent4a4ff504590adfb516502ea332ad0608652b3519 (diff)
downloadrails-cdbd64d1a3afd5a08c393403da61d8c7c1ae6c72.tar.gz
rails-cdbd64d1a3afd5a08c393403da61d8c7c1ae6c72.tar.bz2
rails-cdbd64d1a3afd5a08c393403da61d8c7c1ae6c72.zip
Merge pull request #9252 from senny/8423_hmt_preloading_bug
don't cache invalid subsets when preloading hmt associations
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/associations/preloader/through_association.rb3
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