How to create a dynamic 404 page?

I think you can overwrite the 404.html file in the public dir, though
that wouldn't give you full access to the rails env.

I think you could also set up a catch all route and direct to a
specific action, which would in essence work as a 404. In that action
you'd have to set the 404 status and return the page.

There is more than likely a simpler way that I'm just unfamiliar with
that someone will be swooping in with, but those were just the two
ideas that came to the top of my head.