Reputation: 786
I'm extending Ryan Bates's RailsCast on Carrierwave to multiple file uploaders, each of which should upload to its own S3 bucket. I have one working already. My configuration looks like this:
CarrierWave.configure do |config|
config.fog_credentials = {
:provider => 'AWS',
:aws_access_key_id => '(my access key)',
:aws_secret_access_key => '(my secret key)'
}
config.fog_directory = 'my-bucket'
config.fog_attributes = {'Cache-Control'=>'max-age=315576000'}
end
And my file uploader classes look like this:
class ImageUploader < CarrierWave::Uploader::Base
include CarrierWave::RMagick
process :resize_to_fit => [1024, 1024]
process :quality => 70
storage :fog
end
In my class I call
mount_uploader :image, ImageUploader
Is it possible to change config.fog_directory on a per-upload basis? Inside the class definitions? Somewhere else? Thanks for any help.
Upvotes: 2
Views: 1851