Errno :: ENOENT (no such file or directory) in amazon-s3

I have an application that deploys in heroku using amazon s3, posting images to buckets.This works fine. But when retrieving the same image, an error occurs:

Errno::ENOENT (No such file or directory showing path s3.amazonaws.com/bucket_name/app/public/messages/images/000/000/061/thumb/images.jpeg?1362410115) 

The same copying and pasting the path into the browser url does not work. If I use the name of the bucket as the endpoint, it works, i.e. With the following path

 /bucket_name.s3.amazonaws.com/app/public/messages/images/000/000/061/thumb/images.jpeg?1362410115. 

But I do not know how to configure this url in my model. I follow the heroku method for setting up aws-sdk.

  https://devcenter.heroku.com/articles/paperclip-s3 

The has_attached_file model is similar to the fact that I missed something. For the rest of the configuration, you can check the link above.

 has_attached_file :image, :styles => { :medium => "100x100>", :thumb => "100x100>" } 

thanks

+4
source share
1 answer

Including the given code in config / initializers / paper_clip.rb solved my problem.

  Paperclip::Attachment.default_options.merge!( :url => ':s3_domain_url', :path => 'app/public/:class/:attachment/:id_partition/:style/:filename' ) 
+2
source

All Articles