Ruby on Rails的4 - 回形针AWS图片网址是错误的? [英] Ruby on Rails 4 - Paperclip AWS Image URL is wrong?

查看:95
本文介绍了Ruby on Rails的4 - 回形针AWS图片网址是错误的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用曲别针和AWS一​​起过,但我只是创造了这个轨道4应用程序,我image.url方法展示寻找形象的http://s3.amazonaws.com/ ',当它应该寻找他们的s3-us-west-2.amazonaws.com。我猜想这是因为该地区的第一个客户就是美国标准,而新的是俄勒冈州。

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'. 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?

推荐答案

显然有曾经是一堆的变通办法,但现在有名为s3_host_name的配置选项。

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

这篇关于Ruby on Rails的4 - 回形针AWS图片网址是错误的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆