登录后激活管理员重定向

时间:2013-03-13 01:01:12

标签: ruby-on-rails ruby-on-rails-3 activeadmin

当管理员登录时,它会自动重定向到主主页(即不是管理仪表板)。我不确定为什么会这样做或如何改变它......

的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在用户登录后已更改为重定向(但不应该是管理员登录) - 这是问题吗?

include PublicActivity::StoreController
  protect_from_forgery

def after_sign_in_path_for(resource)
 favourites_path
end

hide_action :current_user

3 个答案:

答案 0 :(得分:2)

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

def after_sign_in_path_for(resource)
     admin_dashboard
end

答案 1 :(得分:1)

我必须这样做:

class ActiveAdmin::Devise::SessionsController
  def after_sign_in_path_for(resource)
    admin_dashboard_path
  end
end

解决问题。

如果需要,它还可以为定制提供一些可能性。

答案 2 :(得分:1)

$(document).ready(function(){})