Sha256: 72290820c068b97406d3ff2f1c8ffa9e585b38c19d43023faa22bf8b947d28a1
Contents?: true
Size: 1.04 KB
Versions: 21
Compression:
Stored size: 1.04 KB
Contents
module CouchRest module Mixins module Attachments # saves an attachment directly to couchdb def put_attachment(name, file, options={}) raise ArgumentError, "doc must be saved" unless self.rev raise ArgumentError, "doc.database required to put_attachment" unless database result = database.put_attachment(self, name, file, options) self['_rev'] = result['rev'] result['ok'] end # returns an attachment's data def fetch_attachment(name) raise ArgumentError, "doc must be saved" unless self.rev raise ArgumentError, "doc.database required to put_attachment" unless database database.fetch_attachment(self, name) end # deletes an attachment directly from couchdb def delete_attachment(name, force=false) raise ArgumentError, "doc.database required to delete_attachment" unless database result = database.delete_attachment(self, name, force) self['_rev'] = result['rev'] result['ok'] end end end end
Version data entries
21 entries across 21 versions & 7 rubygems