Created
May 20, 2015 08:28
-
-
Save yoonwaiyan/73938a0f25256e719334 to your computer and use it in GitHub Desktop.
Handling routing error in Rails 4
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
def routing_error | |
respond_to do |format| | |
format.html { render :file => "#{Rails.root}/public/404", :layout => false, :status => :not_found } | |
format.xml { head :not_found } | |
format.any { head :not_found } | |
end | |
end |
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
match '*unmatched_route', :to => 'application#routing_error', via: [:get, :post] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment