Question

I'm using devise for rails. I have the following route for devise.

devise_for :user

Which routes to 'user/sign_in' and several other.

So I want to change this route to: get 'login'. Is this possible? I tried doing

match 'login', to: 'user/sign_in', via: :get

Which did not work as well, what am I doing wrong, and what does the above code do?

Was it helpful?

Solution

To use /login for sign_in add the following to your config/routes.rb:

devise_scope :user do 
    get 'login', to: 'devise/sessions#new'
end

OTHER TIPS

This'll work:

devise_for :user, :path => 'login'

You might need :users and not :user, FYI.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top