Minimal ActiveAdmin install

ActiveAdmin is a great tool when it comes to rapid admin panel development with Rails applications. Nice design, easy configuration, its all there. The only problem is that it does not explain how to use it with an existing application without using generators. This article will be just about that.

Install ActiveAdmin

Assuming that you already have your Rails 3.2.x application configured and running, add library to your gemfile:

gem 'activeadmin', '~> 0.5.0'

group :assets do
  gem 'sass-rails'
  gem 'coffee-rails'

That should be enough, although they (devs) recommend to install meta_search library too.

Run bundler:

bundle install


Now, first thing our application needs is config/initializers/active_admin.rb:

ActiveAdmin.setup do |config|
  config.site_title            = "Application Name"
  config.authentication_method = false
  config.current_user_method   = false
  config.allow_comments        = false

It makes ActiveAdmin work without any user accounts or authentication, and disables admin comments on resources.

Run asset generator, it'll install main js and css assets.

rails g active_admin:assets

If you're not using dynamic precompilation, modify your application.rb config:

# ...
class Application < Rails::Application
  config.assets.precompile += ['active_admin.css', 'active_admin.js']
# ...

Now, add active admin routes config/routes.rb:

YourApp::Application.routes.draw do

Start application and you're good to go. Documentation covers pretty much everything else at this point.