ruby-on-rails – 使用Rails和Paperclip设置桶名的域名(bucket.s3.amazonaws.com)

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – 使用Rails和Paperclip设置桶名的域名(bucket.s3.amazonaws.com)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
Paperclip文档关于url选项:

You can choose to have the bucket’s name placed domain-style (bucket.s3.amazonaws.com) or path-style (s3.amazonaws.com/bucket).

看起来像设置实际上将桶的名称放置为域风格?我不能强制回形针来产生像bucket.s3.amazonaws.com而不是s3.amazonaws.com/bucket的网址.

解决方法

只要这样设置:
Paperclip::Attachment.default_options[:url] = ':s3_domain_url'

或者像这样:

Paperclip::Attachment.default_options.merge!(
  :url => ':s3_domain_url'
)

猜你在找的Ruby相关文章