I want to completely disable the routes /users/sign_in for get and post.
I was able to successfully override them using the following:
devise_for :users do get "/admin" => "devise/sessions#new", :as => :new_user_session post "/admin" => "devise/sessions#create", :as => :user_session end
And when I run rake routes I see the following:
new_user_session GET /admin(.:format) {:controller=>"devise/sessions", :action=>"new"} user_session POST /admin(.:format) {:controller=>"devise/sessions", :action=>"create"} new_user_session GET /users/sign_in(.:format) {:action=>"new", :controller=>"devise/sessions"} POST /users/sign_in(.:format) {:action=>"create", :controller=>"devise/sessions"}
I can access the sign in from /admin as well as from /users/sign_in. But I want to completely remove the last two rows, is it possible?
I tried some different combinations from the documentation which seems to do it but it also overrides some useful ones, like the password/new and password/edit routes.
Katz's solution no longer works as noted by Cirulli.
Try the following.
devise_for :users, :skip => [:sessions] as :user do get "/admin" => "devise/sessions#new", :as => :new_user_session post "/admin" => "devise/sessions#create", :as => :user_session end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With