embeds_many does not get reset after clear

XMLWordPrintableJSON

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

      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 (Inactive)
              Reporter:
              Neil Shweky (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: