Not able to destroy an embedded document and no errors are produced

XMLWordPrintableJSON

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

      class User
        include Mongoid::Document
        field :email, type: String
        embeds_many :cars, cascade_callbacks: true
      end
      
      class Car
        include Mongoid::Document
        field :model, type: String
        field :trunk_items, type: Array, default: Array.new 
        embedded_in :user
      end
      

      Ran the following command
      User.find_by(email:'test_user@test.com').cars.destroy_all
      => 1

      I also ran:
      test_destroy = User.find_by(email:'test_user@test.com').cars.first.destroy(validate:false)
      => true

      But when I run User.find_by(email:'test_user@test.com').cars the embedded document still exists. I'm running mongoid 3.0.18

            Assignee:
            Durran Jordan
            Reporter:
            cameronkendall
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: