Rails 3 - Amazon S3 Paperclip EU Problem
amazon-s3, paperclip, ruby-on-rails-3, upload
Solution
Did you try this workaround?
Paperclip et les European S3 buckets
Or even this one?
Paperclip, S3, and European Buckets
Problem
I'm using: ``` 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' ``` 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" ``` This works fine, and it allows me to upload the images, and I can verify the image upload / delete using the AWS Management consoler. 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: What it should be: https://s3-eu-west-1.amazonaws.com/fsight/flyers/50/full/4759543368588654950.jpg What it actually is: http://s3.amazonaws.com/fsight/flyers/50/full/4759543368588654950.jpg?1314801178 As you can see, it uses the old default host. I tried placing: ``` 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?