0

I have a Rails 5.1 application with functionality for uploading documents.

I implemented the upload-functionality with Paperclip (version 5.1). The uploads are stored on Amazon S3. Uploading documents works fine initially, but previously uploaded images are broken when I redeploy the application with Capistrano to the production server. When I look in the production.log I see this RoutingError:

    F, [2017-11-06T14:07:26.682736 #446] FATAL -- : [012253d0-c103-4e57-8065-33830ad76b9b] ActionController::RoutingError

(No route matches [GET] "/system/absences/attest_pics/000/000/008/original/boekcover.jpg"):

in the View I implemented the link to the document like this:

        <% if absence.attest_pic.present? %>
        <td>
          <%= link_to "Download", absence.attest_pic.url %>
        </td>
        <% end %>

Does anyone has experience with this behaviour?

Thanks for your help,

Anthony

Toontje
  • 1,415
  • 4
  • 25
  • 43
  • try this: https://github.com/thoughtbot/paperclip/issues/1573 or this: https://stackoverflow.com/questions/7829480/no-route-matches-get-assets – pageman Nov 06 '17 at 13:26
  • I don't have an issue with my RSpec tests, the RoutingError arises when I redeploy with Capistrano – Toontje Nov 06 '17 at 13:32
  • tangentially https://github.com/thoughtbot/paperclip/issues/1573#issuecomment-233063453 (can you change the default options?) or change the environment setting for serving image files. Or you can file an issue at github.com/thoughtbot/paperclip ? – pageman Nov 06 '17 at 13:38
  • found this: https://stackoverflow.com/questions/14925722/serving-static-assets-with-nginx-instead-of-rails-in-rails-3-2 – pageman Nov 06 '17 at 13:41
  • ok I added an issue on github.com/thoughtbot/paperclip – Toontje Nov 06 '17 at 13:50

1 Answers1

2

Take a look in your folder, in the server. If the path your_app/current/public/system don't exists, you need to change the file: config/deploy.rb accept the public/system

set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system')

augustocbx
  • 762
  • 8
  • 8