-
Type:
Bug
-
Resolution: Done
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Hi,
Some callback circular reference is taking my sleep today.
After destroying a child in a referenced relation and updating the parent in a after_destroy callback triggers the destroyed object validation callback.
I know it is hard to understand, so I put a simple app to reproduce the issue.
https://github.com/felipero/mongoid_broken_destroy
To spoil the problem:
Article.create!(name: 'Everything was fine before master from mongoid', comments: [Comment.new])
comment = Comment.first
comment.destroy
results in:
RuntimeError: can't modify frozen BSON::Document
Cloning the demo app and running the specs will show this behavior.