Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-1117

Parent is nil in embedded documents during destroy callback

    • Type: Icon: Task Task
    • Resolution: Done
    • 2.1.5
    • Affects Version/s: None
    • Component/s: None

      Since there is no

      :dependent => :destroy

      for embedded documents I manually trigger their destruction in a before_destroy callback on the parent. In Mongoid 2.1.x it seems that the parent reference becomes nil inside the embedded documents during the destroy callbacks so if I want to do stuff related to the parent (which I do) I'm screwed.

      Gist to reproduce:
      https://gist.github.com/1124824

            Assignee:
            Unassigned Unassigned
            Reporter:
            dbackeus David Backeus
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: