0
votes

I have a user model which has admin and manager role column (using devise), need to have different sign in page for admins and manager

devise_for :users, controllers: {
    sessions: 'users/sessions'
  }

as :user do
    namespace :admins do
      get 'sign_in', to: 'sessions#new'
      post 'sign_in', to: 'sessions#create'
    end
  end

for admin role it has access the Admins::SessionsController controller and for manager it has to access Users::SessionsController, how can I specify that in routes without using devise_for ?

1

1 Answers

0
votes

You need different scopes for user and admin.

devise_for :users, skip: :all
devise_scope :user do
  # custom routes here
end
devise_scope :admin do
  # custom routes here
end

Note that the resource is plural for devise_for but singular for devise_scope.