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

Embedded relation not set when after_save is called on embedded doc

      Possible duplicate of https://jira.mongodb.org/browse/MONGOID-3795.


      When an embedded doc is set via the parents setter (#doc=), it is not available for the parent, when the embedded after_save callback is fired.

      To clarify the problem, i wrote a small test:
      https://gist.github.com/romanlehnert/e0a4b614fabdc89c4fbb2efd5b3181a0

      In the test, i expect the Syncer to receive .perform with the customers address. But actually, it is given nil instead of the address.

      Is this the desired behavior? It seems unexpected for me.

      Env:

      • ruby 2.3.0
      • mongoid 5.0.1

            Assignee:
            Unassigned Unassigned
            Reporter:
            roman_l Roman L
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: