Sha256: 5d6cb59a3139678ce7eaa8be4de94feff4bdfb042703d7621a32ae262fdf2d49

Contents?: true

Size: 467 Bytes

Versions: 2

Compression:

Stored size: 467 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(:destroy) { doc.destroyed = true if delete(doc) }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
mongoid-pre-2.0.0.beta1 lib/mongoid/commands/destroy.rb
mongoid-2.0.0.alpha lib/mongoid/commands/destroy.rb