Skip to content
Snippets Groups Projects
Verified Commit 2b9a25bd authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Handle unmatched routing with not_found method


We need this to prevent routing error when user access URL like /123
when there is no resource located under such name

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 5e9a3944
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -45,6 +45,10 @@ class ApplicationController < ActionController::Base
redirect_to request.referer.present? ? :back : default, options
end
 
def not_found
render_404
end
protected
 
# This filter handles both private tokens and personal access tokens
Loading
Loading
Loading
Loading
@@ -88,4 +88,6 @@ Rails.application.routes.draw do
get ':username.keys' => 'profiles/keys#get_keys', constraints: { username: /.*/ }
 
root to: "root#index"
get '*unmatched_route', to: 'application#not_found'
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment