Reputation: 1771
I have installed devise and activeadmin gem. When I try to login via client then I get redirected to the right page but when I try to login via admin I get redirected to the client login page.
namespace :admin do
# get "/stats" => "stats#stats"
devise_scope :admin_user do
get '/stats/:scope' => "stats#stats", as: :admin_stats
end
end
devise_for :admin_users, ActiveAdmin::Devise.config
ActiveAdmin.routes(self)
namespace :client do
get 'dashboard' => 'dashboard#index', as: 'dashboard'
end
devise_for :users, class_name: 'FormUser', controllers: { omniauth_callbacks: 'omniauth_callbacks', registrations: 'registrations' }
devise_scope :user do
root to: 'devise/registrations#new'
end
def after_sign_in_path_for(resource_or_scope)
client_dashboard_path
end
def after_sign_out_path_for(resource_or_scope)
root_path
end
How can I fix this?
Here is a link to the test app enter link description here
Admin login enter link description here
Upvotes: 0
Views: 66
Reputation: 3073
def after_sign_in_path_for(resource_or_scope)
case resource_or_scope
when AdminUser
admin_dashboard_path
when User
client_dashboard_path
end
end
Upvotes: 1