diff options
author | Zoltan Kiss <zkiss@ackmanndickenson.com> | 2014-10-10 15:13:53 -0500 |
---|---|---|
committer | Zoltan Kiss <zkiss@ackmanndickenson.com> | 2015-03-26 15:58:36 -0500 |
commit | 1813350f0927dde01a11ebbd33a8f6b0deacd073 (patch) | |
tree | 4215b714a4e1b8bdcbdf6ed609fe0b896425bb4c /actionmailer/CHANGELOG.md | |
parent | 8b451e3a315666b93da43e7b61503014661f0ac6 (diff) | |
download | rails-1813350f0927dde01a11ebbd33a8f6b0deacd073.tar.gz rails-1813350f0927dde01a11ebbd33a8f6b0deacd073.tar.bz2 rails-1813350f0927dde01a11ebbd33a8f6b0deacd073.zip |
Fix nested `has many :through` associations on unpersisted instances
Fixes: #16313
Diffstat (limited to 'actionmailer/CHANGELOG.md')
-rw-r--r-- | actionmailer/CHANGELOG.md | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/actionmailer/CHANGELOG.md b/actionmailer/CHANGELOG.md index 86ecb3ee88..68756c350d 100644 --- a/actionmailer/CHANGELOG.md +++ b/actionmailer/CHANGELOG.md @@ -1,3 +1,39 @@ +* Fix nested `has many :through` associations on unpersisted parent instances. + + For example, if you have + + class Post < ActiveRecord::Base + has_many :books, through: :author + has_many :subscriptions, through: :books + end + + class Author < ActiveRecord::Base + has_one :post + has_many :books + has_many :subscriptions, through: :books + end + + class Book < ActiveRecord::Base + belongs_to :author + has_many :subscriptions + end + + class Subscription < ActiveRecord::Base + belongs_to :book + end + + Before: + If `post` is not persisted, e.g `post = Post.new`, then `post.subscriptions` + will be empty no matter what. + + After: + If `post` is not persisted, then `post.subscriptions` can be set and used + just like it would if `post` were persisted. + + Fixes #16313. + + *Zoltan Kiss* + * Add `assert_enqueued_emails` and `assert_no_enqueued_emails`. Example: |