我已经安装了devise和activeadmin gem。当我尝试通过客户端登录然后我被重定向到正确的页面,但当我尝试通过管理员登录时,我被重定向到客户端登录页面。
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
我该如何解决这个问题?
以下是测试应用enter link description here
的链接答案 0 :(得分:1)
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