简体   繁体   English

回形针S3铲斗,过程和环境

[英]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, I want to have dev-image-bucket, dev-audio-bucket, dev-pdf-bucket. 对于生产环境,我有三个存储桶(三个模型,三个存储桶),图像存储桶,音频存储桶,pdf存储桶,但是对于开发环境,我想要有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. 无需proc。 In your model: 在您的模型中:

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

不,这就是我想要的

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM