使用S3时,Paperclip提供错误的URL

时间:2017-10-27 18:02:59

标签: ruby-on-rails amazon-s3 paperclip

正确的网址是:http://s3.dvulgsolucoes.com.br/folder/filename.png我正在获取此网址:http://s3.dvulgsolucoes.com.br.s3.amazonaws.com/folder/filename.png

config.paperclip_defaults = {
  storage: :s3,
  s3_credentials: {
    bucket: 'bucketname.com.br',
    access_key_id: '###',
    secret_access_key: '###',
  }
}

Paperclip::Attachment.default_options[:url] = ':s3_domain_url'
Paperclip::Attachment.default_options[:path] = '/clients/dmg/:class/:attachment/:id_partition/:style/:filename'

1 个答案:

答案 0 :(得分:0)

您可以在回形针上更改回形针的默认网址和路径,编辑paperclip.rb:

Paperclip::Attachment.default_options[:url] = ':s3_domain_url'
Paperclip::Attachment.default_options[:path] = '/:class/:attachment/:id_partition/:style/:filename'

您可以查看Heroku的链接

https://devcenter.heroku.com/articles/paperclip-s3#configuration