From 9b598287dcacf3053024285d173f508499a687bf Mon Sep 17 00:00:00 2001 From: Miles Matthias Date: Mon, 25 May 2015 09:11:25 -0600 Subject: [PATCH 1/2] Include unsigned upload usage in README From https://github.com/assembler/attachinary/issues/108 --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index 8a830356..ab92f1f9 100644 --- a/README.md +++ b/README.md @@ -165,6 +165,23 @@ If you don't want fancy JS features, all you have to do is just switch to `:inpu * do not use colliding identifiers (e.g. `has_attachment :photo` and `has_attachments :photos`) on same model. +## Unsigned Uploads + +If you're using Cloudinary's [unsigned uploads feature](http://cloudinary.com/blog/direct_upload_made_easy_from_browser_or_mobile_app_to_the_cloud) where you can upload to Cloudinary directly from the browser without using Attachinary, you can save the upload in your database as an Attachinary record without triggering another upload by doing the following: + +```ruby +model.upload = { + :version => "123456", + :public_id => "askdjfslkdjflksd", + :resource_type => "image", + :format => "png" +} + +# or + +model.upload = '{"version":"123456","public_id":"askdjfslkdjflksd","resource_type":"image","format":"png"}' +``` + ## Requirements and Compatibility * Cloudinary From 19940fcc08a0c6cfc19f9bbf477c3efdcef2b445 Mon Sep 17 00:00:00 2001 From: Miles Matthias Date: Mon, 25 May 2015 09:12:31 -0600 Subject: [PATCH 2/2] Typo & formatting changes --- README.md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index ab92f1f9..7918be8d 100644 --- a/README.md +++ b/README.md @@ -158,16 +158,9 @@ If you don't want fancy JS features, all you have to do is just switch to `:inpu ``` -## Conventions - -* always use singular identifier after `has_attachment` (e.g. `has_attachment :photo`) -* always use plural identifier after `has_attachments` (e.g. `has_attachments :images`) -* do not use colliding identifiers (e.g. `has_attachment :photo` and `has_attachments :photos`) on same model. - +### Unsigned Uploads -## Unsigned Uploads - -If you're using Cloudinary's [unsigned uploads feature](http://cloudinary.com/blog/direct_upload_made_easy_from_browser_or_mobile_app_to_the_cloud) where you can upload to Cloudinary directly from the browser without using Attachinary, you can save the upload in your database as an Attachinary record without triggering another upload by doing the following: +If you're using Cloudinary's [unsigned uploads feature](http://cloudinary.com/blog/direct_upload_made_easy_from_browser_or_mobile_app_to_the_cloud), where you can upload to Cloudinary directly from the browser without using Attachinary, you can save the upload in your database as an Attachinary record without triggering another upload by doing the following: ```ruby model.upload = { @@ -182,6 +175,14 @@ model.upload = { model.upload = '{"version":"123456","public_id":"askdjfslkdjflksd","resource_type":"image","format":"png"}' ``` + +## Conventions + +* always use singular identifier after `has_attachment` (e.g. `has_attachment :photo`) +* always use plural identifier after `has_attachments` (e.g. `has_attachments :images`) +* do not use colliding identifiers (e.g. `has_attachment :photo` and `has_attachments :photos`) on same model. + + ## Requirements and Compatibility * Cloudinary