Related to HowtoConfigureTheErrorPageForYourRailsApp.
Some errors can occur before any controller is loaded. In those cases, nothing defined in ApplicationController will help, since the controller isn’t around to deal with the exception. To deal with this you can redefine rescue_action_in_public in ActionController::Base in a separate file and pull it in through /config/environment.rb.
/config/environment.rb
- Include your app’s configuration here:
require ‘error_handler_basic’ # defines AC::Base#rescue_action_in_public
/lib/error_handler_basic.rb
class ActionController::Base
def rescue_action_in_public(exception)
render :text => <<TOKEN
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
...
<!-- #{exception} -->