Reputation: 6496
By using devise for user_auth it sets up some default routes (e.g. /user/edit and /user/sign_in). In routes.rb I have
devise_scope :user do
get 'signin' => 'devise/sessions#new'
etc.
end
The problem is that both /signin and /user/sign_in work to link to the sign in page. I want to so how make the /user/sign_in link inactive meaning it gives a 404 error when navigating to that page.
My rake routes is:
new_user_session GET /users/sign_in(.:format) {:action=>"new", :controller=>"devise/sessions"}
user_session POST /users/sign_in(.:format) {:action=>"create", :controller=>"devise/sessions"}
destroy_user_session DELETE /users/sign_out(.:format) {:action=>"destroy", :controller=>"devise/sessions"}
user_password POST /users/password(.:format) {:action=>"create", :controller=>"devise/passwords"}
new_user_password GET /users/password/new(.:format) {:action=>"new", :controller=>"devise/passwords"}
edit_user_password GET /users/password/edit(.:format) {:action=>"edit", :controller=>"devise/passwords"}
PUT /users/password(.:format) {:action=>"update", :controller=>"devise/passwords"}
cancel_user_registration GET /users/cancel(.:format) {:action=>"cancel", :controller=>"registrations"}
user_registration POST /users(.:format) {:action=>"create", :controller=>"registrations"}
new_user_registration GET /users/sign_up(.:format) {:action=>"new", :controller=>"registrations"}
edit_user_registration GET /users/edit(.:format) {:action=>"edit", :controller=>"registrations"}
PUT /users(.:format) {:action=>"update", :controller=>"registrations"}
DELETE /users(.:format) {:action=>"destroy", :controller=>"registrations"}
signin GET /signin(.:format) {:action=>"new", :controller=>"devise/sessions"}
signout GET /signout(.:format) {:action=>"destroy", :controller=>"devise/sessions"}
signup GET /signup(.:format) {:action=>"new", :controller=>"devise/registrations"}
command GET /command(.:format) {:action=>"edit", :controller=>"devise/registrations"}
Upvotes: 0
Views: 1717
Reputation: 4567
Use devise_for to change the path and names of the default urls
devise_for :users, :path => '', :path_names => { :sign_in => 'signin', :sign_out => 'signout', :sign_up => 'signup' }
I would recommend leaving the path names as sign_in, sign_out, and sign_up since signin looks like gibberish.
Also, selectively editing these defaults will probably just make your routes more confusing in the long run. So, unless there is a great reason to overwrite the defaults, you should go with what devise recommends.
Upvotes: 1