# Handling custom error files (404/500) in Rails 3

**URL:** <https://www.ruby-forum.com/t/handling-custom-error-files-404-500-in-rails-3/189269>\
**Category:** Rails\
**Created:** [May 27, 2010, 7:31pm UTC](https://www.ruby-forum.com/t/handling-custom-error-files-404-500-in-rails-3/189269 "2010-05-27T19:31:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anywho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/82dd89/32.png) [@anywho](https://www.ruby-forum.com/u/anywho)\
**Post date:** [May 27, 2010, 7:31pm UTC](https://www.ruby-forum.com/t/handling-custom-error-files-404-500-in-rails-3/189269/1 "2010-05-27T19:31:01Z")

</div>

I’ve been looking at rescue\_from and rescue\_action\_in\_public however,  
none of them have worked without making a catch-all route.

So currently, my solution is to use the catch-all route: match  
‘\*path’ =\> “controller#action” # custom 404 which then renders a 404  
with the appropriate layout whether the user is logged in or not.  
I’ve also set up a rescue\_from to handle ActiveRecord::RecordNotFound  
errors.

It feels like an unsatisfactory solution, and I’m not dealing with 500  
errors at all. I would like to keep the informative errors that rails  
gives during development, but simply have a choice to render a non-  
static page in production.

Help appriciated.

---

<div class="post-metadata">

**Author:** ![anywho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/82dd89/32.png) [@anywho](https://www.ruby-forum.com/u/anywho)\
**Post date:** [May 30, 2010, 7:38pm UTC](https://www.ruby-forum.com/t/handling-custom-error-files-404-500-in-rails-3/189269/2 "2010-05-30T19:38:40Z")

</div>

anyone?
