Reputation: 269
Whilst developing locally, I don't want any images I upload to my s3 bucket to overwrite, or affect in any way those already uploaded through the production app.
My :path argument looks like this
:path => "profile_photo/:id/photo_:style.:extension"
Which means that an uploaded file will be at profile_photo/1/photo_normal.png
Fine, but if I upload an image for my resource with :id 1, it will overwrite the photo that may have been uploaded by an RL user.
The problem could be solved if there was a way to get the current environment, something like this, maybe?
:path => "profile_photo/:environment/:id/photo_:style.:extension"
to output a file path
profile_photo/production/1/photo_normal.png
or profile_photo/development/1/photo_normal.png
This would be ideal, and I don't really want to create a separate bucket for development, I'm just a little strange like that.
I've looked for a place to find which symbols are available to pass as arguments, no success.
How have others solved this problem?
Upvotes: 0
Views: 202
Reputation: 115541
According to the source code here and here, I'm pretty sure you can do:
:path => "profile_photo/:rails_env/:id/photo_:style.:extension"
Upvotes: 2