Module CouchRest::Model::Persistence
In: lib/couchrest/model/persistence.rb

Methods

Classes and Modules

Module CouchRest::Model::Persistence::ClassMethods

Public Instance methods

Create the document. Validation is enabled by default and will return false if the document is not valid. If all goes well, the document will be returned.

Creates the document in the db. Raises an exception if the document is not created properly.

Deletes the document from the database. Runs the :destroy callbacks.

Reloads the attributes of this object from the database. It doesn‘t override custom instance variables.

Returns self.

Trigger the callbacks (before, after, around) and save the document

Saves the document to the db using save. Raises an exception if the document is not saved properly.

Trigger the callbacks (before, after, around) only if the document isn‘t new

Update the document‘s attributes and save. For example:

  doc.update_attributes :name => "Fred"

Is the equivilent of doing the following:

  doc.attributes = { :name => "Fred" }
  doc.save

Protected Instance methods

[Validate]