Search code examples
ruby-on-railsdevise

how to redirect devise_for controller to other than default devise


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


Solution

  • As stated in my comment, you can just add another option to the controllers hash:

    { sessions: 'v1/sessions', omniauth_callbacks: 'v1/sessions' }