Sha256: 17d8be4c0404057faf1e80bf13a90c00cb8bda36db7e8aa1096679e6370acf87

Contents?: true

Size: 380 Bytes

Versions: 19

Compression:

Stored size: 380 Bytes

Contents

# encoding: utf-8
module Mongoid #:nodoc
  module Commands #:nodoc
    module Deletion #:nodoc
      # If the +Document+ has a parent, delete it from the parent's attributes,
      # otherwise delete it from it's collection.
      def delete(doc)
        parent = doc._parent
        parent ? parent.remove(doc) : doc.collection.remove(:_id => doc.id)
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
mongoid-1.1.0 lib/mongoid/commands/deletion.rb
mongoid-1.0.6 lib/mongoid/commands/deletion.rb
mongoid-1.0.5 lib/mongoid/commands/deletion.rb
mongoid-1.0.4 lib/mongoid/commands/deletion.rb
mongoid-1.0.3 lib/mongoid/commands/deletion.rb
mongoid-1.0.2 lib/mongoid/commands/deletion.rb
mongoid-1.0.1 lib/mongoid/commands/deletion.rb
mongoid-1.0.0 lib/mongoid/commands/deletion.rb
mongoid-0.12.0 lib/mongoid/commands/deletion.rb
mongoid-0.11.9 lib/mongoid/commands/deletion.rb
mongoid-0.11.8 lib/mongoid/commands/deletion.rb
mongoid-0.11.7 lib/mongoid/commands/deletion.rb
mongoid-0.11.6 lib/mongoid/commands/deletion.rb
mongoid-0.11.5 lib/mongoid/commands/deletion.rb
mongoid-0.11.4 lib/mongoid/commands/deletion.rb
mongoid-0.11.3 lib/mongoid/commands/deletion.rb
mongoid-0.11.2 lib/mongoid/commands/deletion.rb
mongoid-0.11.1 lib/mongoid/commands/deletion.rb
mongoid-0.11.0 lib/mongoid/commands/deletion.rb