Sha256: e05462b47d75d2186a93ddfbb7fffff4c20b93055c8f81d33561c5b31405e014

Contents?: true

Size: 530 Bytes

Versions: 37

Compression:

Stored size: 530 Bytes

Contents

# encoding: utf-8
module Mongoid # :nodoc:
  module Relations #:nodoc:
    module Cascading #:nodoc:
      class Delete < Strategy

        # Execute the cascading deletion for the relation if it already exists.
        # This should be optimized in the future potentially not to load all
        # objects from the db.
        #
        # @example Perform the cascading delete.
        #   strategy.cascade
        def cascade
          relation.to_a.each { |doc| doc.delete } if relation
        end
      end
    end
  end
end

Version data entries

37 entries across 37 versions & 4 rubygems

Version Path
mongoid-multi-db-3.0.0 lib/mongoid/relations/cascading/delete.rb
mongoid-2.2.6 lib/mongoid/relations/cascading/delete.rb
mongoid-2.3.5 lib/mongoid/relations/cascading/delete.rb
mongoid-2.2.5 lib/mongoid/relations/cascading/delete.rb
mongoid-2.3.4 lib/mongoid/relations/cascading/delete.rb
mongoid-2.2.4 lib/mongoid/relations/cascading/delete.rb
mongoid-2.3.3 lib/mongoid/relations/cascading/delete.rb
mongoid-2.3.2 lib/mongoid/relations/cascading/delete.rb
mongoid-2.2.3 lib/mongoid/relations/cascading/delete.rb
mongoid-2.3.1 lib/mongoid/relations/cascading/delete.rb
mongoid-2.3.0 lib/mongoid/relations/cascading/delete.rb
mongoid-2.2.2 lib/mongoid/relations/cascading/delete.rb
mongoid-2.2.1 lib/mongoid/relations/cascading/delete.rb
mongoid-2.2.0 lib/mongoid/relations/cascading/delete.rb
mongoid-2.1.9 lib/mongoid/relations/cascading/delete.rb
mongoid-2.1.8 lib/mongoid/relations/cascading/delete.rb
mongoid-2.1.7 lib/mongoid/relations/cascading/delete.rb
mongoid-2.1.6 lib/mongoid/relations/cascading/delete.rb
mongoid-2.1.5 lib/mongoid/relations/cascading/delete.rb
mongoid-2.1.4 lib/mongoid/relations/cascading/delete.rb