documentation for Document#copy and #move, copied from Database

This commit is contained in:
Matt Lyon 2009-02-01 23:34:30 -08:00 committed by Chris Anderson
parent 571cd257e0
commit 9b3b56bbf5

View file

@ -57,12 +57,18 @@ module CouchRest
result['ok'] result['ok']
end end
# copies the document to a new id. If the destination id currently exists, a rev must be provided.
# <tt>dest</tt> can take one of two forms if overwriting: "id_to_overwrite?rev=revision" or the actual doc
# hash with a '_rev' key
def copy(dest) def copy(dest)
raise ArgumentError, "doc.database required to copy" unless database raise ArgumentError, "doc.database required to copy" unless database
result = database.copy(self, dest) result = database.copy(self, dest)
result['ok'] result['ok']
end end
# moves the document to a new id. If the destination id currently exists, a rev must be provided.
# <tt>dest</tt> can take one of two forms if overwriting: "id_to_overwrite?rev=revision" or the actual doc
# hash with a '_rev' key
def move(dest) def move(dest)
raise ArgumentError, "doc.database required to copy" unless database raise ArgumentError, "doc.database required to copy" unless database
result = database.move(self, dest) result = database.move(self, dest)