Sha256: fd3f6752cf8a1730064b838243f45940f5a76a7805fdaeafacaee2d024a3d000

Contents?: true

Size: 770 Bytes

Versions: 2

Compression:

Stored size: 770 Bytes

Contents

# encoding: utf-8
module Mongoid
  module Persistence

    # Contains common logic for delete operations.
    module Deletion

      # Wrap all the common delete logic for both root and embedded
      # documents and then yield to the block.
      #
      # @example Execute common delete logic.
      #   prepare do |doc|
      #     collection.remove({ :_id => "value })
      #   end
      #
      # @param [ Proc ] block The block to call.
      #
      # @return [ true ] Always true.
      #
      # @since 2.1.0
      def prepare(&block)
        document.cascade!
        yield(document)
        document.freeze
        document.destroyed = true
        IdentityMap.remove(document)
        document.clear_timeless_option
        true
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mongoid-3.1.5 lib/mongoid/persistence/deletion.rb
mongoid-3.1.4 lib/mongoid/persistence/deletion.rb