Class CouchRest::Document
In: lib/couchrest/document.rb
Parent: Response

Methods

copy   database   destroy   id   id=   new?   new_document?   rev   save   uri   use_database  

Included Modules

CouchRest::Attachments

Attributes

database  [RW] 

Public Class methods

override the CouchRest::Model-wide default_database This is not a thread safe operation, do not change the model database at runtime.

Public Instance methods

copies the document to a new id. If the destination id currently exists, a rev must be provided. dest can take one of two forms if overwriting: "id_to_overwrite?rev=revision" or the actual doc hash with a ‘_rev’ key

Returns the document‘s database

Deletes the document from the database. Runs the :delete callbacks. Removes the _id and _rev fields, preparing the document to be saved to a new _id. If bulk is true (defaults to false) the document won‘t actually be deleted from the db until bulk save.

returns true if the document has never been saved

new_document?()

Alias for new?

Saves the document to the db using create or update. Also runs the :save callbacks. Sets the _id and _rev fields based on CouchDB‘s response. If bulk is true (defaults to false) the document is cached for bulk save.

Returns the CouchDB uri for the document

[Validate]