Object is still on the parent's relation after being destroyed

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • 6.0.0
    • 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.

            Assignee:
            Unassigned
            Reporter:
            Felipe Rodrigues de Almeida
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: