Recently found an easy way to test rails exceptions raised in production while in development.
Though you could just as easily use:
script/server -e production
Short of that the following works perfectly:
Update config/development.rb
change:to:config.action_controller.consider_all_requests_local = false
config.action_controller.consider_all_requests_local = true
Then update controllers/application.rb
add as the last method (unless you have additional protected methods then add to those):
protected
def local_request?
false
end
This works because rails will check if a raised exception is a local request. If it is a local request the “development” mode error screen will be presented to you like this:

Otherwise the 500 or 404 error pages will be displayed to the user.
Both modifications are needed since there are two ways a request is considered local 1.) which is controlled in the config folder and 2.) A request is also considered local if the request is being served on the local machine (127.0.0.1).
