Idea: status code 404 AND debug info for RecordNotFound, RoutingError

The exceptions ActiveRecord::RecordNotFound and ActionController::RoutingError will give a 500 status in dev and test, but 404 in production.

This means you can’t easily write JS to rely on 404 responses from Ajax requests: it will work in production but not dev or test.

It might be sensible to have Rails still show the useful debug info for these exceptions in dev and test, but with a 404 status code.

What do you think?

Actually, RoutingError seems to do this already. I noticed the lack in RecordNotFound, and incorrectly assumed RecordNotFound had the same problem.

So RoutingError gets it right, but maybe RecordNotFound should do the same?

This seems like a regression in 4.0.0. I believe that previous versions were returning 404’s for RecordNotFound in development.

Oh, I let the custom better_errors page fool me. The standard error page does give a 404 for RecordNotFound (in 3.2, but I’m sure Rails 4 works as well).

Sorry to bring this up before experimenting more, and thanks for pointing me in the right direction.