Sha256: c51efb34c7f9941b4156e2d0eec2a1ed489b5c4f700f521e5e655d03a1012cc2

Contents?: true

Size: 533 Bytes

Versions: 24

Compression:

Stored size: 533 Bytes

Contents

# encoding: utf-8
module Mongoid # :nodoc:
  module Relations #:nodoc:
    module Cascading #:nodoc:
      class Destroy < 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 destroy.
        #   strategy.cascade
        def cascade
          relation.to_a.each { |doc| doc.destroy } if relation
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 3 rubygems

Version Path
mongoid-2.2.0 lib/mongoid/relations/cascading/destroy.rb
mongoid-2.1.9 lib/mongoid/relations/cascading/destroy.rb
mongoid-2.1.8 lib/mongoid/relations/cascading/destroy.rb
mongoid-2.1.7 lib/mongoid/relations/cascading/destroy.rb
mongoid-2.1.6 lib/mongoid/relations/cascading/destroy.rb
mongoid-2.1.5 lib/mongoid/relations/cascading/destroy.rb
mongoid-2.1.4 lib/mongoid/relations/cascading/destroy.rb
mongoid-2.1.3 lib/mongoid/relations/cascading/destroy.rb
mongoid-2.1.2 lib/mongoid/relations/cascading/destroy.rb
mongoid-2.1.1 lib/mongoid/relations/cascading/destroy.rb
mongoid-2.1.0 lib/mongoid/relations/cascading/destroy.rb
mongoid-braxton-2.0.2 lib/mongoid/relations/cascading/destroy.rb
mongoid-2.0.2 lib/mongoid/relations/cascading/destroy.rb
mongoid-2.0.1 lib/mongoid/relations/cascading/destroy.rb
mongoid-2.0.0 lib/mongoid/relations/cascading/destroy.rb
mongoid-2.0.0.rc.8 lib/mongoid/relations/cascading/destroy.rb
mongoid-2.0.0.rc.7 lib/mongoid/relations/cascading/destroy.rb
stonegao-mongoid-2.0.0.rc.6 lib/mongoid/relations/cascading/destroy.rb
mongoid-2.0.0.rc.6 lib/mongoid/relations/cascading/destroy.rb
mongoid-2.0.0.rc.5 lib/mongoid/relations/cascading/destroy.rb