But it's not working for some reason.In most cases now I find myself checking exists?first, which I'd rather not do for the extra database hit.

However, it tends to work more like my thinking out the problem.And don't even get me started on rescue_action_in_public, whichonly seems to work in my application_controller, not in anyspecific controllers I use...

Re: Best way to deal with ActiveRecord::RecordNotFound

IMO, RecordNotFound is like a null pointer exception or divide by zero exception. If your application is generating them, there is something wrong with it. So to me, the way to deal with RecordNotFound is with more and better tests, and more carefully designed apps.

Re: Best way to deal with ActiveRecord::RecordNotFound

Yes, but there are certain situations, like trying to show a list of bookmarks when you haven't saved any, that don't seem quite as catastrophic...

The other situations I'm trying to deal with are more for people accessing the URLs directly--trying to view or delete items that don't exist. I guess in those cases it makes sense to do the equivalent of a 404 error.

With finds though, there are many cases where a nil result find is not that big of a deal.