Skip to content
This repository has been archived by the owner on Jun 6, 2018. It is now read-only.

Commit

Permalink
Changing some readme text
Browse files Browse the repository at this point in the history
  • Loading branch information
nhocki committed May 29, 2012
1 parent 0ba564e commit 8a04bcc
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions README.textile
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
h1. Paperclip S3 Storage
h2. Paperclip S3 Storage

This gem will force paperclip to store attachments on S3 if your application is in production. It's great for "Heroku":http://heroku.com apps.

h1. Important Notes
h2. Important Notes

If you're in fact using "Heroku":http://heroku.com, and you want the attachments to have custom paths. *PLEASE* do not use *RAILS_ROOT*. Why? Every time you deploy your app to "Heroku":http://heroku.com, you're changing the RAILS_ROOT, so all your uploaded files will be lost and your bucket *WILL* be a mess!

A default, Heroku-working path is on by default, so you can just use it.

h1. How to Use
h2. How to Use

This gem will read your S3 credentials from the server's environment. You will need to provide a secret key, an access key and a bucket. (You can provide an *_s3_credentials_* hash options with *_access_key_id_* and *_secret_access_key_* instead.)
Add the gem to your Gemfile with <pre>gem "paperclip-s3"</pre> and run <pre>bundle install</pre>.

If you are using "Heroku":http://heroku.com, it's really easy to do this, just
Then, you'll need to setup some ENV variables. You will need to provide a secret key, an access key and a bucket. (You can provide an *_s3_credentials_* hash options with *_access_key_id_* and *_secret_access_key_* instead.)

If you are using "Heroku":http://heroku.com, you can use the <pre>config:add</pre> command:

<pre>
heroku config:add S3_BUCKET=your_bucket_name
Expand All @@ -26,15 +28,21 @@ If you are using *https* as the S3 Protocol, you can also specify it as a Heroku
heroku config:add S3_PROTOCOL=https
</pre>

`Notice that the S3 protocol will default to *http*`
<b>Notice that the S3 protocol will default to http</b>

You can optionally specify which environments will use S3 with the S3_ENVIRONMENTS variable (using a comma-separated list).
You can optionally specify which environments will use S3 with the S3_ENVIRONMENTS variable (using a comma-separated list).

<pre>
ENV['S3_ENVIRONMENTS'] = 'staging,production' # defaults to production only
</pre>

After you've done this, you can use paperclip normally. The gem just extends the methods and changes the options to force the S3 Storage. You can *even* use the same options (like path, default_style, etc.)
*After you've done this, you can use paperclip normally*. The gem just extends the methods and changes the options to force the S3 Storage. You can *even* use the same options (like path, default_style, etc.)

<pre>
class User < ActiveRecord::Base
has_attached_file :avatar, default_url: "/images/defaults/photo-missing.jpg"
end
</pre>

h2. Contribute

Expand Down

0 comments on commit 8a04bcc

Please sign in to comment.