aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-02-19 04:33:42 -0800
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-02-19 04:33:42 -0800
commitb4e053e867232e28c7b99b0d935161d1e4559ced (patch)
treef73e5e490d1e5de640f83797a2b19325e2f82fb5 /activerecord/lib
parent46b65ba274bea6f8d52926e4b243db28d6377fc0 (diff)
parent587f563c40cfada296d6e8d6bbe3c4d7fc6ce93b (diff)
downloadrails-b4e053e867232e28c7b99b0d935161d1e4559ced.tar.gz
rails-b4e053e867232e28c7b99b0d935161d1e4559ced.tar.bz2
rails-b4e053e867232e28c7b99b0d935161d1e4559ced.zip
Merge pull request #9322 from senny/backport_9252
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 ad6374d09a..4cb7b56b57 100644
--- a/activerecord/lib/active_record/associations/preloader/through_association.rb
+++ b/activerecord/lib/active_record/associations/preloader/through_association.rb
@@ -37,7 +37,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 (preload_options != through_options) ||
+ (reflection.options[:source_type] && through_reflection.collection?)
owner.association(through_reflection.name).reset
end