How to create a dynamic 404 page?

Hi all

When a user of my website reaches a page that doesn’t exist, the
404.html page is rendered and the header status 404 is sent.
I’d like to have this 404 page dynamic, e.g. I’d like to display the
user a mailto link with subject that contains the actual link of the
document that was not found:

mailto:[email protected]?subject=Broken link -

How can I achieve that? I don’t want to use JavaScript or such stuff,
I’d like to have full access to the “normal” Rails environment in


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.

On Oct 29, 6:21 pm, Joshua M. [email protected]