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/CHANGELOG.md | |
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/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 4fa37cc5c2..4489ca1aff 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,5 +1,27 @@ ## Rails 4.0.0 (unreleased) ## +* 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* + * Don't run after_commit callback when creating through an association if saving the record fails. |