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

Embedded 1-1 relation doesn't work properly

    • Type: Icon: Task Task
    • Resolution: Done
    • 12_01_17
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      I have 4 models(Job,Parcel,Action, Spec) with following relation
      <pre><code>
      class Job
      embeds_many :parcels
      end
      </code></pre>

      <pre><code>
      class Parcel
      embedded_in :job
      end
      </code></pre>

      <pre><code>
      class Action
      embed_one :spec
      end
      </code></pre>

      <pre><code>
      class Spec
      embedded_in :car
      end
      </pre></code>

      When i create first record everything is ok, but after creating second record, spec returns nil.

      In the end, when i trying to save second record, mongoid updates first record spec instead of creating spec for new record.

            Assignee:
            Unassigned Unassigned
            Reporter:
            EhsanYousefi EhsanYousefi [X]
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: