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

Embedded elements memoization is still broken after b7bea2d5b90ccf3d6a493869a79ea1f1b384d2af

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Blocker - P1 Blocker - P1
    • 5.0.0
    • Affects Version/s: 5.0.0
    • Component/s: None
    • None

      This issue of memoizing the children appears to still be calling issues. Embedded docs a few levels in will silently not save.

      Using HEAD of master, currently set to 230876157420ba850849603ad0d16aa5ec3a693c

      <code>
      class Foo
      include Mongoid::Document
      embeds_many :bars
      end

      class Bar
      include Mongoid::Document
      embedded_in :foo
      embeds_one :deepest
      end

      class Deepest
      include Mongoid::Document
      embedded_in :bar
      end

      f = Foo.create
      => #<Foo _id: 55b948526a6f6e6f67000001, >
      f.changed?
      => false
      f.bars.new
      => #<Bar _id: 55b948586a6f6e6f67000002, >
      f.changed?
      => true
      f.save
      => true
      f.bars.first.build_deepest
      => #<Deepest _id: 55b948656a6f6e6f67000003, >
      f.bars.first.changed?
      => false
      f.save
      => true
      f.bars.first.deepest.persisted?
      => false
      Foo.collection.find(_id: f.id).first
      => {"_id"=>BSON::ObjectId('55b948526a6f6e6f67000001'), "bars"=>[

      {"_id"=>BSON::ObjectId('55b948586a6f6e6f67000002')}

      ]}
      <code>

            Assignee:
            durran.jordan@mongodb.com Durran Jordan
            Reporter:
            jonhyman Jon Hyman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: