Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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