From d5bf649a535948e70692e521ce3070595334e71b Mon Sep 17 00:00:00 2001 From: Seb Jacobs Date: Thu, 15 Jan 2015 23:03:23 +0000 Subject: Add support for bidirectional destroy dependencies Prior to this commit if you defined a bidirectional relationship between two models with destroy dependencies on both sides, a call to `destroy` would result in an infinite callback loop. Take the following relationship. class Content < ActiveRecord::Base has_one :content_position, dependent: :destroy end class ContentPosition < ActiveRecord::Base belongs_to :content, dependent: :destroy end Calling `Content#destroy` or `ContentPosition#destroy` would result in an infinite callback loop. This commit changes the behaviour of `ActiveRecord::Callbacks#destroy` so that it guards against subsequent callbacks. Thanks to @zetter for demonstrating the issue with failing tests[1]. [1] rails#13609 --- activerecord/CHANGELOG.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'activerecord/CHANGELOG.md') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index c777af342f..d0dcff801b 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,19 @@ +* Add support for bidirectional destroy dependencies. + + Fixes #13609. + + Example: + + class Content < ActiveRecord::Base + has_one :position, dependent: :destroy + end + + class Position < ActiveRecord::Base + belongs_to :content, dependent: :destroy + end + + *Seb Jacobs* + * `time` columns can now affected by `time_zone_aware_attributes`. If you have set `config.time_zone` to a value other than `'UTC'`, they will be treated as in that time zone by default in Rails 5.0. If this is not the desired -- cgit v1.2.3