简体   繁体   English

Ruby on Rails 4 - Paperclip AWS Image URL错误?

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

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/ ', when it should be looking for them at 's3-us-west-2.amazonaws.com'. 之前我曾经使用过paperclip和AWS,但我刚创建了这个Rails 4应用程序,我的image.url方法显示在' http://s3.amazonaws.com/ '上查找图像,当它应该是他们来自's3-us-west-2.amazonaws.com'。 I'm assuming this is because the region for the first account is US Standard, whereas the new one is Oregon. 我假设这是因为第一个帐户的区域是美国标准,而新的帐户是俄勒冈州。

Any way for me to change the region in the config files or something? 我有什么方法可以更改配置文件中的区域或其他东西?

Apparently there used to be a bunch of workarounds for this, but now there is an option in the config called s3_host_name. 显然以前有一堆解决方法,但现在配置中有一个名为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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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