Class: CouchPotato::Database

Inherits:
Object
  • Object
show all
Defined in:
lib/simply_stored/couch/ext/couch_potato.rb

Instance Method Summary collapse

Instance Method Details

#destroy_document(document, run_callbacks = true) ⇒ Object

the original implementation does not delete if callbacks are skipped



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/simply_stored/couch/ext/couch_potato.rb', line 28

def destroy_document(document, run_callbacks = true)
  if run_callbacks
    document.run_callbacks :destroy do
      document._deleted = true
      couchrest_database.delete_doc document.to_hash
    end
  else
    document._deleted = true
    couchrest_database.delete_doc document.to_hash
  end
  document._id = nil
  document._rev = nil
end