问题
I have
devise_for :user, path: 'v1/user', class_name: "V1::User",controllers: {sessions: 'v1/sessions'
I like to have it redirect all not just sessions including :omniauth_callbacks to v1/sessions
or something like this
devise_for :user, path: 'v1/user', class_name: "V1::User",controllers: {sessions: 'v1/sessions'}, controllers: {omniauth_callbacks: 'v1/sessions'}
it will errors
warning: key :controllers is duplicated and overwritten on line 16
回答1:
As stated in my comment, you can just add another option to the controllers hash:
{ sessions: 'v1/sessions', omniauth_callbacks: 'v1/sessions' }
回答2:
Just include omniauth_callbacks
key in the controller hash.
devise_for :user, path: 'v1/user', class_name: "V1::User",controllers: {sessions: 'v1/sessions', omniauth_callbacks: 'v1/sessions'}
Now your redirects for both email login and oauth login will be to v1/sessions
来源:https://stackoverflow.com/questions/58277724/how-to-redirect-devise-for-controller-to-other-than-default-devise