Answer the question
In order to leave comments, you need to log in
How to catch ActionController::RoutingError in Rails when rendering images in development?
There is an application in which old images are constantly cleared. When displaying items with removed images, ActionController::RoutingError pops up, which are difficult to catch when testing.
How to catch ActionController::RoutingError when rendering images in Rails and return default instead of missing images?
Exceptions themselves occur during tests, and it is very difficult to catch them by simply catching exceptions. Used by Rspec and Capybara.
Answer the question
In order to leave comments, you need to log in
From rails, in general, no way, because. images in production should be served by nginx. Rails has a production setting that forcibly disables static feedback
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_files = false
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question