Rails Quick Tip: Show Detailed Errors in Production

OK, before you go yell at me, I know enabling detailed error messages on a production web application is a Bad Thing™. The security guy in me hates finding a production application that spews back all kinds of details to a user when something goes wrong, and I’ve had many a developer disable detailed error messages on their production applications.

But the developer side of me sometimes needs to see the details just for a short time to debug an issue that is only happening in production and not in the test/development environments. So here is how you do it. Just please disable it again immediately when you’re done troubleshooting.

In config/environments/production.rb under Rails 3.1, change:

config.consider_all_requests_local       = false

to true. Restart your application server. That is it.

And again, friends don’t let friends run applications with detailed errors on, so please set it back to false when you’re done debugging your application.

Leave a Reply

Your email address will not be published. Required fields are marked *