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

Mongoid save fails silently without embedded_in relation

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

      Just added a bounty, here:
      http://stackoverflow.com/questions/13204896/mongoid-save-fails-silently-without-embedded-in-relation

      I have one document embedded in another in Mongoid.

          class A < B
            include Mongoid::Document
            embeds_one :shipping_address, class_name: 'Address'
      

      I have, in my case, omitted the inverse relation:

          class Address
             # embedded_in :A
      

      Why is it, that although the API works fine and completely as expected:

           address = A.address
           address.zip = 1234
      
           a.changed? #true
      
           address.save
      
           a.changed? #false
      

      The document is not actually saved?

      If i return the embedded_in statement, the save actually works fine.

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

              Created:
              Updated:
              Resolved: