Skip to content

Instantly share code, notes, and snippets.

@yoonwaiyan
Created May 20, 2015 08:28
Show Gist options
  • Save yoonwaiyan/73938a0f25256e719334 to your computer and use it in GitHub Desktop.
Save yoonwaiyan/73938a0f25256e719334 to your computer and use it in GitHub Desktop.
Handling routing error in Rails 4
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
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