Sha256: 8219b02a4693eadd8e1aad7ddd7e8232c1ea25929e57f5d84af1c4e1f58aa43d

Contents?: true

Size: 480 Bytes

Versions: 55

Compression:

Stored size: 480 Bytes

Contents

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

55 entries across 55 versions & 1 rubygems

Version Path
mongoid-0.9.4 lib/mongoid/commands/destroy.rb
mongoid-0.9.3 lib/mongoid/commands/destroy.rb
mongoid-0.9.2 lib/mongoid/commands/destroy.rb
mongoid-0.9.1 lib/mongoid/commands/destroy.rb
mongoid-0.9.0 lib/mongoid/commands/destroy.rb
mongoid-0.8.10 lib/mongoid/commands/destroy.rb
mongoid-0.8.9 lib/mongoid/commands/destroy.rb
mongoid-0.8.8 lib/mongoid/commands/destroy.rb
mongoid-0.8.7 lib/mongoid/commands/destroy.rb
mongoid-0.8.6 lib/mongoid/commands/destroy.rb
mongoid-0.8.5 lib/mongoid/commands/destroy.rb
mongoid-0.8.4 lib/mongoid/commands/destroy.rb
mongoid-0.8.3 lib/mongoid/commands/destroy.rb
mongoid-0.8.2 lib/mongoid/commands/destroy.rb
mongoid-0.8.1 lib/mongoid/commands/destroy.rb
mongoid-0.7.10 lib/mongoid/commands/destroy.rb
mongoid-0.7.9 lib/mongoid/commands/destroy.rb
mongoid-0.7.8 lib/mongoid/commands/destroy.rb
mongoid-0.7.7 lib/mongoid/commands/destroy.rb
mongoid-0.7.6 lib/mongoid/commands/destroy.rb