Created
February 10, 2016 12:01
-
-
Save shah743/e1c9b62de9f41d52cd69 to your computer and use it in GitHub Desktop.
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
# config/routes.rb | |
%w( 404 422 500 ).each do |code| | |
get code, :to => "errors#show", :code => code | |
end | |
# app/views/errors/404.html.haml | |
%h1 404 - Not Found | |
class ErrorsController < ApplicationController | |
def show | |
render status_code.to_s, :status => status_code | |
end | |
protected | |
def status_code | |
params[:code] || 500 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment