Ruby on Rails 4 - Paperclip AWS Image URL is wrong?

前端 未结 1 1716
暖寄归人
暖寄归人 2021-01-04 22:12

I\'ve used paperclip and AWS together before, but I just created this Rails 4 app, and my image.url method is showing looking for the image at \'http://s3.amazonaws.com/\',

相关标签:
1条回答
  • 2021-01-04 22:45

    Apparently there used to be a bunch of workarounds for this, but now there is an option in the config called s3_host_name.

    ExampleApp:Application.configure do
    
      config.paperclip_defaults = {
        :storage => :s3,
        :s3_host_name => 's3-us-west-2.amazonaws.com',
        :s3_credentials => {
          :bucket => '#',
          :access_key_id => '#',
          :secret_access_key => '#'
        }
      }
    
    end
    
    0 讨论(0)
提交回复
热议问题