开发者

Paperclip S3 buckets, proc and environments

开发者 https://www.devze.com 2022-12-08 08:15 出处:网络
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,

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

精彩评论

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

关注公众号