Sha256: 747aebddbe9bc90bfafa5548dda716c9722f2e3f3062dc249a70f3faa4fbbfcf

Contents?: true

Size: 498 Bytes

Versions: 13

Compression:

Stored size: 498 Bytes

Contents

# encoding: utf-8
module Mongoid #:nodoc:
  module Commands
    class Destroy
      # 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.collection.remove(:_id => doc.id)
        doc.run_callbacks :after_destroy
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
mongoid-0.10.4 lib/mongoid/commands/destroy.rb
mongoid-0.10.3 lib/mongoid/commands/destroy.rb
mongoid-0.10.2 lib/mongoid/commands/destroy.rb
mongoid-0.10.1 lib/mongoid/commands/destroy.rb
mongoid-0.10.0 lib/mongoid/commands/destroy.rb
mongoid-0.9.12 lib/mongoid/commands/destroy.rb
mongoid-0.9.11 lib/mongoid/commands/destroy.rb
mongoid-0.9.10 lib/mongoid/commands/destroy.rb
mongoid-0.9.9 lib/mongoid/commands/destroy.rb
mongoid-0.9.8 lib/mongoid/commands/destroy.rb
mongoid-0.9.7 lib/mongoid/commands/destroy.rb
mongoid-0.9.6 lib/mongoid/commands/destroy.rb
mongoid-0.9.5 lib/mongoid/commands/destroy.rb