diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-02-14 09:28:55 -0800 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-02-14 15:33:30 -0200 |
commit | c5451777b038c5e48567f69256986ae42a2cde48 (patch) | |
tree | dbbc7e1735ba0250ded7403d4ac0baf9d8e731d7 /activerecord/CHANGELOG.md | |
parent | ee3e3a90f31af5845849dc631ff301e79c95b28a (diff) | |
download | rails-c5451777b038c5e48567f69256986ae42a2cde48.tar.gz rails-c5451777b038c5e48567f69256986ae42a2cde48.tar.bz2 rails-c5451777b038c5e48567f69256986ae42a2cde48.zip |
Merge pull request #9252 from senny/8423_hmt_preloading_bug
don't cache invalid subsets when preloading hmt associations
Conflicts:
activerecord/CHANGELOG.md
activerecord/test/cases/associations/eager_test.rb
Diffstat (limited to 'activerecord/CHANGELOG.md')
-rw-r--r-- | activerecord/CHANGELOG.md | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 67f3d47d10..8f3c6e78f7 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,25 @@ +* Preloading `has_many :through` associations with conditions won't + cache the `:through` association. This will prevent invalid + subsets to be cached. + Fixes #8423. + + Example: + + class User + has_many :posts + has_many :recent_comments, -> { where('created_at > ?', 1.week.ago) }, :through => :posts + end + + a_user = User.includes(:recent_comments).first + + # this is preloaded + a_user.recent_comments + + # fetching the recent_comments through the posts association won't preload it. + a_user.posts + + *Yves Senn* + * Fix counter cache columns not updated when replacing `has_many :through` associations. Backport #8400. |