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

Model.destroy does not follow ActiveModel /AR behavior

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

      After calling #destroy on a record #new_record? returns true. This is invalid and causes problems, for example when using with rails' dom_id helper.

      The correct behavior, according to https://github.com/rails/rails/blob/master/activerecord/lib/active_record/persistence.rb, should be:

      record.destroy

      record.destroyed? -> true
      record.new_record? -> false
      record.persisted? -> false

            Assignee:
            Unassigned Unassigned
            Reporter:
            gucki Corin Langosch
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: