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

Setting embeds_many should only update deltas vs. deleting and setting entire array

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 6.1.1
    • Affects Version/s: None
    • Component/s: None

      With the following

      class Example
        include Mongoid::Document
      
        embeds_many embedded_examples
      end
      
      class EmbeddedExample
        include Monoigd::Document
      
        embedded_in example
      
       after :create do
         # Do something
       end
      end
      

      And then doing

        example = Example.create
        example.embedded_examples << EmbeddedExample.new
      

      Then

        example.embedded_examples = example.embedded_examples
      

      The after_create callback in EmbeddedExample should only invoked once.

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            kareemk kareemk
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: