Topic: Paperclip failing in production

I am using Paperclip to let users upload PDFs. In development, it works fine, but in production, it fails to retrieve the uploaded files. There seems to be two different problems here.

The first is the "url" method. It misses the context for the project. That is fine in development, Webrick has no context, but in production on Tomcat, it fails.

So for example:

http://[prod-server]:9090/system/training_log/events/certificates/000/011/883/original/EFAA_GLC.pdf

Should be:

http://[prod-server]:9090/[my-context]/system/training_log/events/certificates/000/011/883/original/EFAA_GLC.pdf

The code I am using to generate the URL is this:

<%= link_to 'Certificate', record.certificate.url(:original, false) %>





The second problem appears if I type in the context by hand; I still do not get the uploaded file returned. Paperclip has successfully uploaded it, eg:

C:\apache-tomcat-6.0.32\webapps\[my-context]\WEB-INF\public\system\training_log\events\certificates\000\011\883\original\EFAA_GLC.pdf

But Rails is refusing to serve it, as it is looking for this:

C:\apache-tomcat-6.0.32\webapps\[my-context]\system\training_log\events\certificates\000\011\883\original\EFAA_GLC.pdf




Running on Rails version 3.2.11, with Ruby 1.9.3, on JRuby 1.7.2, using Tomcat, on Windows.


Any advice gratefully received!

Last edited by F2Andy (2013-02-19 10:28:00)