Forum: Ruby on Rails Can 404.html use the default layout?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Sean H. (Guest)
on 2005-12-23 00:21
(Received via mailing list)
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
Marc L. (Guest)
on 2005-12-23 03:54
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.
This topic is locked and can not be replied to.