Created
April 13, 2010 11:03
-
-
Save jamesbebbington/364504 to your computer and use it in GitHub Desktop.
Rendering custom dynamic http error pages in a Rails app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
# alias_method :rescue_action_locally, :rescue_action_in_public # Uncomment to test in development environment. | |
def render_optional_error_file(status_code) | |
request.format = 'html' # Force html format so that requests to the likes of /foo/bar.png result in an HTML error page. | |
render :template => 'errors/http_error', :status => status_code, :locals => {:status_code => status_code} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment