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

setting a has_many association persists the children

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

      This is a regression in 3.0.

      ~~~ruby
      class Customer
      include Mongoid::Document
      belongs_to :company
      end

      class Company
      include Mongoid::Document
      has_many :customers
      end

      company = Company.create!
      customer = Customer.new
      company.customers = [customer]

      customer.persisted? # => true
      ~~~

      Note that: company.customers.build.persisted? # => false

            Assignee:
            durran Durran Jordan
            Reporter:
            gerad Gerad Suyderhoud
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: