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

Expose changes in embedded documents on top-level document

    • Type: Icon: Improvement Improvement
    • Resolution: Incomplete
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 7.1.1
    • Component/s: Attributes
    • Labels:
      None

      I was not able to find a mention of this issue in the history, my apologies if it has already been addressed or answered.  

      The Dirty module does not appear to be properly tracking changes to embedded documents.   When embedded document attributes are changed via the nested attributes path, they do not appear in the parent level `changes` hash.    In this example, the embedded document model is called "Post" and has a field titled "name".   Parent embeds_many posts

      parent.posts_attributes= {"0": {subject: "test"}}
      parent.save
      parent.changes
      => {}

      Thank you for all of your work on mongoid.  This behavior affects the mongoid-history gem issue #33. 

            Assignee:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Reporter:
            dvboom@hotmail.com Don Vanboom
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: