Sha256: 98b447c2987a7431e47d1a28f5cdd4369b89fc2834281876a6b3f0038aca8e72

Contents?: true

Size: 518 Bytes

Versions: 2

Compression:

Stored size: 518 Bytes

Contents

# encoding: utf-8
module Mongoid #:nodoc:
  module Commands
    class Destroy
      extend Deletion
      # Performs a destroy of the supplied +Document+, with the necessary
      # callbacks. It then deletes the record from the collection.
      #
      # Options:
      #
      # doc: A new +Document+ that is going to be destroyed.
      def self.execute(doc)
        doc.run_callbacks :before_destroy
        doc.destroyed = true if delete(doc)
        doc.run_callbacks :after_destroy
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mongoid-1.2.14 lib/mongoid/commands/destroy.rb
mongoid-1.2.13 lib/mongoid/commands/destroy.rb