Jason Harder
Jason Harder

Reputation: 441

How can I modify ActiveAdmin redirect?

I am working within active admin to have an admin dashboard for my model - however when i go to localhost:3000/admin/login and login I get redirected to localhost:3000 instead of being pointed to localhost3000/admin/dashboard.

How can I adjust this? - Tried modifying the load path to

  config.load_paths = [File.join(Rails.root, "admin", "dashboard")]

I also checked my routes and I think the crux of it is that my rails root is / but I mean , shouldn't it be for any other user on the site?

Thanks for any clarification !

Upvotes: 0

Views: 336

Answers (1)

chumakoff
chumakoff

Reputation: 7024

When you add devise routes in the config/routes.rb file, you can pass some options:

# config/routes.rb
devise_for :users, ActiveAdmin::Devise.config

ActiveAdmin::Devise.config looks something like this:

{
 :path=>:admin,
 :controllers=>
  {:sessions=>"active_admin/devise/sessions",
   :passwords=>"active_admin/devise/passwords",
   :unlocks=>"active_admin/devise/unlocks",
   :registrations=>"active_admin/devise/registrations",
   :confirmations=>"active_admin/devise/confirmations"},
 :path_names=>{:sign_in=>"login", :sign_out=>"logout"},
 :sign_out_via=>[:delete, :get]
}

The :path=>:admin option in this case tells devise that /admin is the root path.

Check this in your code.

Upvotes: 2

Related Questions