I have a pretty straightforward model and attachment
has_attached_file :upload,
:storage => :s3,
:bucket => \'bestofbauer\',
:s3_cred
You need to set your environment variables. Here's two different ways to do it:
Every time you run rails server
or any other command that accesses your S3 account you need to include your keys:
$ MyAccessKEY=ACCESS_KEY MySecretKEY=SECRET_KEY rails server
I'm assuming you're using bash so edit your ~/.bash_rc
or ~/.bash_profile
to set your environment variables
export MyAccessKEY=ACCESS_KEY
export MySecretKEY=SECRET_KEY
Then open a new terminal window and double-check that they're set
$ echo $MyAccessKey
> ACCESS KEY PRINTS OUT HERE
If you're deploying to Heroku then you'll want to provide your environment variables there as well:
$ heroku config:add MyAccessKEY=ACCESS_KEY MySecretKEY=SECRET_KEY
You can review your Heroku config:
$ heroku config
It will list out all of the config variables you have for that app.
You'll probably want to put your S3 bucket name in an ENV setting as well so you don't mess up your bucket when testing locally.