I have been looking for a simple answer to this for a ridiculously long time and it seems like this has to be so plainly obvious and simple because no one has an easy, idiot proof tutorial.
Anyway, all I want to do is to have a single 404.html static page that loads whenever ANY error is thrown. Ideally this should only happen in production and staging.
I feel like this should be the easiest thing to do... but I can't figure it out.
Any help is much appreciated.
in your ApplicationController
unless ActionController::Base.consider_all_requests_local rescue_from Exception, :with => :render_404 end private def render_404 render :template => 'error_pages/404', :layout => false, :status => :not_found end
now set up error_pages/404.html
and there you go
...or maybe I'm overcautious with Exception and you should rescue from RuntimeError instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With