Adnan Pirota
Adnan Pirota

Reputation: 309

Rails with Paperclip not working in Production

I am using Paperclip gem in my Rails 5 app and in development everything was OK but in production I no images are shown and in puma log I get error:

ActionController::RoutingError (No route matches [GET] "/system/articles/images/000/000/003/medium/learn_language.jpg"):

and in my app folder when I go to public/system/articles/images/000/000/003/medium the image learn_language.jpg is there, and I can't figure out the reason why the images are not appearing

Upvotes: 3

Views: 768

Answers (1)

DarkSideF
DarkSideF

Reputation: 473

On Rails 5 (tested on 5.0.0.rc1) if you ran rails without nginx or different proxy server like

rails s -e production

when for Paperclip you need to set

config.public_file_server.enabled = true

in your config/environments/production.rb

Or you could set RAILS_SERVE_STATIC_FILES env variable because by default rails check it

config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?

Upvotes: 3

Related Questions