ActiveAdmin with Devise Rails login twice

2019-06-25 05:33发布

问题:

I have a Rails app that was already setup to use devise with User model. I just add ActiveAdmin and it uses a separate model name AdminUser. This new model also uses devise. The problem that I have is:

When I go to localhost:3000/admin - the admin login page, the app directs me first to localhost:3000/users/sign_in - the general user login page. In other words, to go to admin page, I have to login twice.

Is there anyway to fix this?

回答1:

I tried to add this into config/initializer/active_admin.rb:

config.skip_before_filter :authenticate_user!

And it works.