简体   繁体   中英

Paperclip providing wrong URL when using S3

The correct url is: http://s3.dvulgsolucoes.com.br/folder/filename.png and I'm getting this url: 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'

You can change the default URL and path from paperclip, editing paperclip.rb on initializer:

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

You can check this link from Heroku

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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