lib/couchrest/mixins/extended_attachments.rb in couchrest-0.28 vs lib/couchrest/mixins/extended_attachments.rb in couchrest-0.30
- old
+ new
@@ -42,9 +42,15 @@
def attachment_url(attachment_name)
return unless has_attachment?(attachment_name)
"#{database.root}/#{self.id}/#{attachment_name}"
end
+ # returns URI to fetch the attachment from
+ def attachment_uri(attachment_name)
+ return unless has_attachment?(attachment_name)
+ "#{database.uri}/#{self.id}/#{attachment_name}"
+ end
+
private
def encode_attachment(data)
::Base64.encode64(data).gsub(/\r|\n/,'')
end
\ No newline at end of file