Method: CouchRest::Model::DocumentQueries::ClassMethods#get!
- Defined in:
- lib/couchrest/model/document_queries.rb
#get!(id, db = database) ⇒ Object Also known as: find!
Load a document from the database by id An exception will be raised if the document isn’t found
Returns
- Object
-
if the document was found
or Exception
Parameters
- id<String, Integer>
-
Document ID
- db<Database>
-
optional option to pass a custom database to use
55 56 57 58 59 60 61 62 |
# File 'lib/couchrest/model/document_queries.rb', line 55 def get!(id, db = database) raise CouchRest::Model::DocumentNotFound if id.blank? doc = db.get id build_from_database(doc) rescue RestClient::ResourceNotFound raise CouchRest::Model::DocumentNotFound end |