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 No exceptions will be raised if the document isn’t found
Returns
- Object
-
if the document was found
or
- Nil
-
Parameters
- id<String, Integer>
-
Document ID
- db<Database>
-
optional option to pass a custom database to use
35 36 37 38 39 40 41 |
# File 'lib/couchrest/model/document_queries.rb', line 35 def get(id, db = database) begin get!(id, db) rescue nil end end |