ruby-on-rails - 使用带有载波 gem 的多个 S3 存储桶

标签 ruby-on-rails ruby amazon-s3 carrierwave

我最近刚刚设置了我的 Rails 3.2 应用程序以使用 carrierwave gem 并将文件上传到 S3。我看不到的是能够为每个上传者使用不同的存储桶。有谁知道这是否可能?

最佳答案

存储桶是通过 fog_directory 配置指定的。此配置选项在 uploader 上定义,可以简单地用您自己的方法覆盖。

只需将以下内容添加到您的 uploader :

def fog_directory
  # your bucket name here
end

关于ruby-on-rails - 使用带有载波 gem 的多个 S3 存储桶,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9658909/

相关文章:

ruby-on-rails - Rails - 本地机器上现有的开发 Postgres 数据库到 Heroku

sql - ruby rails : Query where date equals another date (ignoring time)

amazon-web-services - 将大型数据集从 Redshift 卸载到 S3 失败并出现 I/O 错误

ruby - 将除英文字母和数字以外的所有字符替换为下划线

ruby-on-rails - Ruby:调用方法列表,直到一个方法返回 true

java - AWS lambda : How to access S3 bucket from Lambda function using java

concurrency - Amazon S3 是否保证写入顺序?

ruby-on-rails - 在 Rails 应用程序中将 excel 导入到 sqlite

ruby-on-rails - Ruby on Rails的奇怪事件

ruby - rb-apps 脚本在 Mountain Lion 中不起作用