开发者

'No route matches' with paperclip and S3 on Heroku

Setting up paperclip to use S3 on my local dev system was a snap. However, I am not able to get it to work on Heroku.

The file uploads successfully:

[paperclip] Saving attachments.
[paperclip] saving photos/2/small.jpg
[paperclip] saving photos/2/original.jpg

However, views that try to link to the upload get a routing error:

ActionController::RoutingErr开发者_如何学Cor (No route matches "/photos/small/missing.png" with {:method=>:get}):

Notice how it is using 'missing' for the file name and is using '.png' for the extension even though the file is a '.jpg'.

I have tried numerous combinations of the :url and :path options with has_attached_file according the various blog posts and tutorials I have found (including Heroku's docs), but none seem to work.

What are the correct steps to use paperclip with S3 on Heroku?


Found the problem: needed to update the database.

heroku rake:db:migrate
heroku restart

I had done what I thought would have accomplished the same thing already: heroku rake db:schema:load, but perhaps that doesn't work or something went wrong in the process.

Anyhow, doing that, along with removing the calls to attr_accessor as suggested on another blog, solved the problem.


I just had this exact same problem. Ran fine in dev, uploaded files to s3 in prod but wouldn't show the URL for uploaded images. Running

heroku restart

was what fixed it. No need to run db:migrate (unless, of course, you need to migrate the database).

Thanks for the info!


Can you paste the code from your form please? I'm guessing that you have forgotten to add :html => {:multipart => true}) to the form_for tag

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜