nested embedded_in work incorrectly when object was saved

XMLWordPrintableJSON

    • None
    • None
    • None
    • None
    • None
    • None
    • None

      see a code example:

      There are three models , as this:

      class User
        include Mongoid::Document
        embeds_many :projects
      end
      
      class Project
        embedded_in :user
        embeds_many :tasks
      end
      
      class Task
        embedded_in :project
      end
      

      Now create them to use:

      user = User.new
      project = Project.new
      task = Task.new
      project.tasks << task
      user.projects << project
      user.save
      

      Then query:
      {{user.reload.projects[0].tasks }}
      output
      [] !!

      I hope it should output [task]

      I found this describe about this:
      Append one or many child addresses, saving them if the person is persisted

      Thx.

            Assignee:
            Unassigned
            Reporter:
            windy
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: