所以我使用了Devise,但我发现我需要使用我使用的rails generate devise MODEL
。但有没有办法让/sign_in
等第四,而不是/MODEL/sign_in
?
rails generate devise
?
答案 0 :(得分:0)
在routes.rb
中添加路径选项:
devise_for :users, path: '', controllers: { omniauth_callbacks: "users/omniauth_callbacks",
registrations: "users/registrations",
sessions: "users/sessions" }
现在路线:
user_password POST /password(.:format) devise/passwords#create
new_user_password GET /password/new(.:format) devise/passwords#new
edit_user_password GET /password/edit(.:format) devise/passwords#edit
PATCH /password(.:format) devise/passwords#update
PUT /password(.:format) devise/passwords#update
cancel_user_registration GET /cancel(.:format) users/registrations#cancel
user_registration POST / users/registrations#create
new_user_registration GET /sign_up(.:format) users/registrations#new
代替:
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) users/registrations#cancel
user_registration POST /users(.:format) users/registrations#create
new_user_registration GET /users/sign_up(.:format) users/registrations#new