Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Active admin redirects after login

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

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'

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
like image 459
tessad Avatar asked Feb 17 '23 05:02

tessad


1 Answers

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

def after_sign_in_path_for(resource)
     admin_dashboard
end
like image 165
tessad Avatar answered Mar 03 '23 15:03

tessad