开发者

Paperclip S3 buckets, proc and environments

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,开发者_如何学Go 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.


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" 


Nah, this is what I was looking for

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜