Created
June 28, 2012 10:10
-
-
Save emiltin/3010444 to your computer and use it in GitHub Desktop.
This file contains hidden or 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/application.rb | |
| config.exceptions_app = self.routes | |
| #config/routes.rb | |
| match "/404.:format", :to => "application#error_route_not_found" | |
| #app/controllers/application.rb | |
| def error_route_not_found | |
| respond_to do |format| | |
| format.html { render 'errors/route_not_found', :status => :not_found } | |
| format.any { render :nothing => true, :status => :not_found } | |
| end | |
| end | |
| #command line | |
| > curl "http://www.localhost:3000/nowhere.xml" => # bunch of html.. only want to return the status code when the format is not html! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment