OUR BLOG

Thoughts on development, design and the world we live in.



ActiveAdmin with Existing Devise Authentication

By sarah in Uncategorized. Posted on July 29th

I’m modifying an existing Rails app to use ActiveAdmin — one of the new generation of Rails admin consoles (aka dynamic scaffolding for your models).  I like its approach to customization, where it assumes we’ll need to. The docs are well-written and clear, but fairly thin; however, I found a number of good resources published elsewhere:

With a little help from stackoverflow, I got it working with my existing user model.

Note: ActiveAdmin uses kaminari, instead of will_paginate. There’s some discussion of making it more compatible, but I just switched to kaminari.

add to Gemfile:

Then on the command line:

in your config/initializers/active_admin.rb you configure your devise routes, instead of these:

if you are using the default name “user” for existing Devise authentication, change to:

Then define:

You could put it into the initializer, but I put this in my ApplicationController which seemed a somewhat better place for it.

I use cucumber to test that I’ve got everything configured correctly:

Steps are defined like this

Using Warden test helpers, which I set up in features/support/env.rb

 

 

By sarah | Posted in Uncategorized | Comments (1)

One Comment

  1. Roelof wobben
    Posted November 19, 2012 at 7:10 am | Permalink

    I did all the steps but now all the logins fail with a 401 error message.

Post a Comment

Your email is never shared. Required fields are marked *

*
*