我使用的是:
Paperclip 2.3.16
Rails 3.0.9
Ruby 1.9.2
AWS - S3 0.6.2
我试图用回形针上传至欧盟(爱尔兰)的水桶。我有以下的在我的模型:
I'm trying to use paperclip the upload to the EU (Ireland) based bucket. I have the following in my model:
has_attached_file :image, :styles => { :grid => '90x128#', :list => '140x200#', :original => '400x548'},
:storage => :s3,
:s3_credentials => "#{RAILS_ROOT}/config/s3.yml",
:url => 'flyers/:id/:style/:basename.:extension',
:path => 'flyers/:id/:style/:basename.:extension',
:bucket => 'fsight'
在我的environment.rb我已经设置通过使用AWS / S3默认主机相关欧盟一个写:
In my environment.rb I have set the write to use the AWS/s3 Default Host to the relevant EU one by using:
require "aws/s3"
AWS::S3::DEFAULT_HOST.replace "s3-eu-west-1.amazonaws.com"
这工作得很好,而且它可以让我上传的图像,我可以确认的图片上传/删除使用AWS管理安慰时,安慰。
This works fine, and it allows me to upload the images, and I can verify the image upload / delete using the AWS Management consoler.
不过,我有一个问题想我的网站上显示的图像时。图像不加载和我已经确定的原因,因为生成的URL使用旧的默认主机。例如:
However, I have a problem when trying to display the images on my site. The images do not load and I have identified the cause, as the URL generated uses the old default host. Eg:
什么应该是: https://s3-eu-west-1.amazonaws.com/fsight/flyers/50/full/4759543368588654950.jpg
它实际上是什么: http://s3.amazonaws.com/fsight/flyers/50/full/4759543368588654950.jpg?1314801178
正如你所看到的,它使用旧的默认主机。
As you can see, it uses the old default host.
我试图把:
Paperclip.interpolates(:s3_eu_url) do |att, style|
"#{att.s3_protocol}://s3-eu-west-1.amazonaws.com/#{att.bucket_name}/#{att.path(style)}"
end
但随后开始收到以下错误:
But then started receiving the following error:
wrong number of arguments (0 for 1)
Extracted source (around line #9):
<img src= <%= @event.image.url(:original) %>
我知道回形针有使用欧盟桶的一些问题,但可能有人帮助我?
I know Paperclip has some issues with using EU Buckets, but could anybody help me with this?
你有没有尝试这种解决方法吗?
Did you try this workaround?
回形针等莱欧洲S3桶
甚至这一个?
回形针,S3和欧洲桶