public
Description: <b>Please go to <a href="http://github.com/arunthampi/activecouch/">http://github.com/arunthampi/activecouch/</a> for the master repos.</b> ActiveCouch is a simple, convenient, Ruby-idiomatic wrapper for CouchDB
Homepage: http://code.google.com/p/activecouch/
Clone URL: git://github.com/chuyeow/activecouch.git
- Instance level delete method which can be used to delete itself
arunthampi (author)
Mon Jan 21 08:59:31 -0800 2008
commit  1eb61667938e7f621fe4772f3b7d5964adcece67
tree    881c00363447e57928cb69c72525e3f37427e1f2
parent  adb9ab58b62c5b782dacdafda03316cedc69b421
...
107
108
109
 
 
 
 
 
 
 
 
 
 
 
110
111
112
...
328
329
330
 
331
332
333
...
362
363
364
365
 
 
 
366
367
368
...
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
...
339
340
341
342
343
344
345
...
374
375
376
 
377
378
379
380
381
382
0
@@ -107,6 +107,17 @@ module ActiveCouch
0
       rev.nil?
0
     end
0
 
0
+ # Deletes a document from a CouchDB database.
0
+ def delete
0
+ if new?
0
+ raise ActiveCouchError, "You must specify a revision for the document to be deleted"
0
+ elsif id.nil?
0
+ raise ActiveCouchError, "You must specify an ID for the document to be deleted"
0
+ else
0
+ connection.delete("/#{self.class.database_name}/#{id}?rev=#{rev}")
0
+ end
0
+ end
0
+
0
     class << self # Class methods
0
 
0
       def inherited(subklass)
0
@@ -328,6 +339,7 @@ module ActiveCouch
0
       end
0
 
0
       private
0
+
0
         # Returns the class descending directly from ActiveCouch in the inheritance hierarchy.
0
         def class_of_active_couch_descendant(klass)
0
           if klass.superclass == Base
0
@@ -362,7 +374,9 @@ module ActiveCouch
0
           end
0
         end
0
         
0
- # First parse the JSON.
0
+ # Instantiates a collection of ActiveCouch::Base objects, based on the
0
+ # result obtained from a CouchDB View.
0
+ #
0
         # As per the CouchDB Permanent View API, the result set will be contained
0
         # within a JSON hash as an array, with the key 'rows'
0
         # The actual CouchDB object which needs to be initialized is obtained with

Comments

    No one has commented yet.