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

embeds_many does not get reset after clear

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 7.4.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible

      Take the following case: 

      class Band
        include Mongoid::Document
        embeds_many :labels
      end
      class Label
        include Mongoid::Document
        field :name, type: String
        embedded_in :band
      end
      Band.delete_all
      label = Label.new(name: "Neil")
      b = Band.create!
      b.labels << label
      b.labels.clear
      b.labels << label
      b.reload
      b.labels # []
       

            Assignee:
            neil.shweky@mongodb.com Neil Shweky (Inactive)
            Reporter:
            neil.shweky@mongodb.com Neil Shweky (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: