puxuyq
Last Updated: February 25, 2016
·
1.24K
· rebyn
3

Getting Paperclip to work on your local machine

There are steps ignored by Rails newbie (me!), and it takes days to figure it out. So here is what you should make sure well-met before moving on to the tests.

Getting Paperclip to work with Rails on localhost

A more detailed instruction on Heroku: https://devcenter.heroku.com/articles/paperclip-s3

What I'll be telling here is the things you'll probably miss

a. Add these to .bash_profile (Note: Fill in with your Amazon account credentials)

export AWS_ACCESS_KEY_ID=XXXXXXXXXX
export AWS_SECRET_ACCESS_KEY=XXXXXXXXXX
export AWS_BUCKET=XXXXXXXXXX

b. This is my development.rb (Note: Copy and paste without changing anything)

Paperclip.options[:command_path] = "/usr/local/bin/"

config.paperclip_defaults = {
    :storage => :s3,
    :s3_credentials => {
      :bucket => ENV['AWS_BUCKET'],
      :access_key_id => ENV['AWS_ACCESS_KEY_ID'],
      :secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
    }
}

Be sure you rebundle your Rails app with the latest paperclip and aws-s3 gems. Also, make sure you quit your Terminal and run everything again since this is an update to your .bash_profile file.

Best,
- T.
qio.me/rebyn

Say Thanks
Respond