views:

210

answers:

2

From reading the documentation I understand this might be doable, but I don't know how!

For the production environment I have three buckets (three models, three buckets) image-bucket, audio-bucket, pdf-bucket, but for the development environment, I want to have dev-image-bucket, dev-audio-bucket, dev-pdf-bucket.

How do I set the proc? Do I set up multiple configuration files, example code would be greatly appreciated.

A: 

No need for a proc. In your model:

has_attached_file :image,
                  :storage => :s3,
                  :s3_credentials => "#{RAILS_ROOT}/config/s3.yml",
                  :path => "whatever",
                  :bucket => "#{Rails.env}-image-bucket"
digitalfrost
A: 

Nah, this is what I was looking for

:bucket => lambda { |photo| "#{(Rails.env.development? ? 'dev-' : '' )}feature-photos" }

rordude