Does anyone know how to integrate Active Admin with Authlogic (I'm using authlogic_ldap_authenticatable gem to authenticate to AD)? I know Active Admin uses Devise, so what changes should I make to Active Admin for it to work with Authlogic? Thanks in advance.
1 Answers
Note: I used Rails 3.2.8 and Active Admin 0.5.0 when I did this.
Here's one way to do it:
First, update Gemfile by adding
gem activeadmin
, and run therails generate active_admin:install
. These are as instructed in the Active Admin README.Typically there's already a User model that uses Authlogic, and if you plan to use that, remove all files for the new Admin User that Active Admin has generated by default:
- db/migrate/*_create_admin_users.rb (migration file)
- app/models/admin_user.rb
- spec/models/admin_user_spec.rb
Remove Devise-specific files:
- config/locales/devise.en.yml
- config/initializers/devise.rb
Remove the Devise reference in config/routes.rb.
There's a generated file
app/admin/admin_user.rb
. You can reuse it by renaming the file touser.rb
, registerUser
in it instead ofAdminUser
, and remove indices on columns specific to Devise. Or, you can just delete the file altogether, and just create your own from scratch.Update the following in your Active Admin config (see
config/initializers/active_admin.rb
):- config.authentication_method
- config.current_user_method
- config.logout_link_path
The default
config.authentication_method
is:authenticate_admin_user
. Set it to whatever before filter method you use for requiring an admin user, e.g.:require_admin
. The defaultconfig.current_user_method
is:current_admin_user
. A typical Rails app that uses Authlogic might have a:current_user
method for this. Andconfig.logout_link_path
should be set to your path for logging out, e.g.:logout_path
.
You may need to modify these instructions according to your case.

- 8,270
- 3
- 16
- 15
-
3If you use `rails generate active_admin:install --skip-users` in step 1, then you don't need to do 2 / 3 / 4 / 5. You still need to do step 6. And there are sometimes problems with rspec... – Tim Diggins Jan 24 '13 at 12:42