It's a little known fact that you can easily substitute the default Rails HTML error pages with something more pleasant. You may have noticed the 404.html
, 422.html
and 500.html
files that are generated with every new Rails project and wondered if there's a clean way to style them like the rest of your application. There is, and it's surprisingly simple.
The default status code templates are served by a Rack exception application. You can override this to be any Rack compatible app, including your applications router:
# config/application.rb
config.exceptions_app = self.routes