| Module | CouchRest::Model::Persistence::ClassMethods |
| In: |
lib/couchrest/model/persistence.rb
|
Creates a new instance, bypassing attribute protection and uses the type field to determine which model to use to instanatiate the new object.
a document instance
Defines an instance and save it directly to the database
returns the reloaded document or raises an exception
The value to use for this model‘s model_type_key. By default, this shouls always be the string representation of the class, but if you need anything special, overwrite this method.
Name a method that will be called before the document is first saved, which returns a string to be used for the document‘s _id.
Because CouchDB enforces a constraint that each id must be unique, this can be used to enforce eg: uniq usernames. Note that this id must be globally unique across all document types which share a database, so if you‘d like to scope uniqueness to this class, you should use the class name as part of the unique id.