Can 404.html use the default layout?


#1

Hi everyone,

How do I get the 404.html to use the default layout in
app/layouts/application.rhtml?

Or is that the wrong question? Should I be rerouting 404 errors to an
application controller action, which I can then customize as a 404?

Thanks,

Sean


#2

Sean H. wrote:

Hi everyone,

How do I get the 404.html to use the default layout in
app/layouts/application.rhtml?

Or is that the wrong question? Should I be rerouting 404 errors to an
application controller action, which I can then customize as a 404?

Thanks,

Sean

Yes to your second option.

In routes.rb put the following at the end (after the default rails
route):

map.connect ‘*path’, :controller => ???, :action => ??? unless
::ActionController::Base.consider_all_requests_local

This will redirect only if the rails application is in test or
production mode. In development mode it will give you the full rails
error messages.

There are some good examples on http://www.bigbold.com/snippets/ I
believe of things you can do.