Skip to content

Instantly share code, notes, and snippets.

@adamdilek
Created February 2, 2015 12:17
Show Gist options
  • Save adamdilek/a1b4e1e691508bc30088 to your computer and use it in GitHub Desktop.
Save adamdilek/a1b4e1e691508bc30088 to your computer and use it in GitHub Desktop.
rescue_from Exception, :with => :server_error
def server_error(exception)
respond_to do |format|
format.html { render template: 'errors/internal_server_error', layout: 'layouts/application', status: 500 }
format.all { render nothing: true, status: 500}
end
end
rescue_from ActiveRecord::RecordNotFound, :with => :page_not_found
rescue_from ActionController::RoutingError, :with => :page_not_found
def page_not_found
respond_to do |format|
format.html { render template: 'errors/not_found', layout: 'layouts/application', status: 404 }
format.all { render nothing: true, status: 404 }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment