Skip to content

Instantly share code, notes, and snippets.

@jamesbebbington
Created April 13, 2010 11:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesbebbington/364504 to your computer and use it in GitHub Desktop.
Save jamesbebbington/364504 to your computer and use it in GitHub Desktop.
Rendering custom dynamic http error pages in a Rails app
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