Class | CouchRest::ExtendedDocument |
In: |
lib/couchrest/more/extended_document.rb
|
Parent: | Document |
Same as CouchRest::Document but with properties and validations
new_document? | -> | new_record? |
for compatibility with old-school frameworks |
casted_by | [RW] | Accessors |
Automatically set updated_at and created_at fields on the document whenever saving occurs. CouchRest uses a pretty decent time format by default. See Time#to_json
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.
Saves the document to the db using save. Raises an exception if the document is not saved properly.
Takes a hash as argument, and applies the values by using writer methods for each key. Raises a NoMethodError if the corresponding methods are missing. In case of error, no attributes are changed.
Takes a hash as argument, and applies the values by using writer methods for each key. It doesn‘t save the document at the end. Raises a NoMethodError if the corresponding methods are missing. In case of error, no attributes are changed.