Since devise is also a useful function, I am confused about the routing that each method automatically generates. If you have the same problem, please do.
devise_for
routes.rb
devise_for :users
python
$ rails routes
Prefix Verb URI Pattern Controller#Action
new_user_session GET /users/sign_in(.:format) devise/sessions#new
user_session POST /users/sign_in(.:format) devise/sessions#create
destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy
user_password POST /users/password(.:format) devise/passwords#create
new_user_password GET /users/password/new(.:format) devise/passwords#new
edit_user_password GET /users/password/edit(.:format) devise/passwords#edit
PATCH /users/password(.:format) devise/passwords#update
PUT /users/password(.:format) devise/passwords#update
cancel_user_registration GET /users/cancel(.:format) devise/registrations#cancel
user_registration POST /users(.:format) devise/registrations#create
new_user_registration GET /users/sign_up(.:format) devise/registrations#new
edit_user_registration GET /users/edit(.:format) devise/registrations#edit
PATCH /users(.:format) devise/registrations#update
PUT /users(.:format) devise/registrations#update
DELETE /users(.:format) devise/registrations#destroy
Action name | request | resources | devise_for |
---|---|---|---|
new | GET | /users/new | /users/sign_up(.:format) |
edit | GET | /users/:id/edit | /users/edit(.:format) |
show | GET | /users/:id | None |
index | GET | /users | None |
create | POST | /users | /users(.:format) |
update | PATCH / PUT | /users | /users(.:format) |
destroy | DELETE | /users | /users(.:format) |
devise_scope
routes.rb
devise_scope :user do
get 'signin' => 'devise_token_auth/sessions#new'
post 'signin' => 'devise_token_auth/sessions#create'
post 'signup' => 'users#create'
put 'update' => 'users#update'
end
python
$ rails routes
Prefix Verb URI Pattern Controller#Action
signin GET /signin(.:format) devise_token_auth/sessions#new
POST /signin(.:format) devise_token_auth/sessions#create
signup POST /signup(.:format) users#create
update PUT /update(.:format) users#update
mount_devise_token_auth_for
routes.rb
mount_devise_token_auth_for 'User', controllers: {
registrations: 'users'
}
python
$ rails routes
Prefix Verb URI Pattern Controller#Action
signin GET /signin(.:format) devise_token_auth/sessions#new
POST /signin(.:format) devise_token_auth/sessions#create
signup POST /signup(.:format) users#create
update PUT /update(.:format) users#update
Recommended Posts