活动管理员在登录后重定向 [英] Active admin redirects after login

查看:76
本文介绍了活动管理员在登录后重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

管理员登录后,会自动重定向到主页(即不是管理控制台)。我不确定为什么要这么做或如何更改...

When an admin logs in, it automatically redirects to the main home page (i.e. not the admin dashboard). I'm not sure why it does this or how to change it...

routes.rb

routes.rb

ActiveAdmin.routes(self)

  devise_for :admin_user, ActiveAdmin::Devise.config


  get "guidelines/topic"
  get "guidelines/topichospital"
  get "guidelines/topicspecialty"
  get "guidelines/favourite"
  get "profiles/show"
  get "guidelines/show"

root :to => 'guidelines#index'

我的application_controller.rb已更改为在用户登录后重定向(但不应t是管理员登录)-这是问题吗?

my application_controller.rb has been changed to redirect after user login (but shouldn't be admin login) - is this the problem?

include PublicActivity::StoreController
  protect_from_forgery

def after_sign_in_path_for(resource)
 favourites_path
end

hide_action :current_user


推荐答案

感谢Zippie,我找到了答案。在admin_controller.rb中,我添加了:

Thanks to Zippie I found the answer. In admin_controller.rb I added:

def after_sign_in_path_for(resource)
     admin_dashboard
end

这篇关于活动管理员在登录后重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆