设计+主动管理重定向

我无法为我的应用程序设置重定向。 用户应该转到他们的个人资料(用户/节目),管理员应该去管理仪表板..我该如何设置?

目前收到以下错误:

NameError in ActiveAdmin::Devise::SessionsController#create undefined local variable or method `admin' for # 

应用控制器

 def after_sign_in_path_for(resource_or_scope) if admin redirect_to admin_dashboard_path else @user end end end 

您没有要访问的admin变量,您需要检查您所提供的参数是什么。

 def after_sign_in_path_for(resource) stored_location_for(resource) || if resource.is_a?(Admin) admin_dashboard_path else user_path(resource) end end 

你也不应该在这个方法中重定向,它应该只返回一个设计可以使用的路径。

 if resource.class == User root_path elsif resource.class == AdminUser admin_root_path else end