- General Configuration
- Site Title Options
- Internationalization (I18n)
- Load paths
- Utility Navigation
- Working with Resources
- Rename the Resource
- Customize the Namespace
- Customize the Menu
- Scoping the queries
- Customizing resource retrieval
- Belongs To
- Customizing the Index Page
- Customizing the CSV format
- Customizing the Form
- Customize the Show Page
- Sidebar Sections
- Custom Controller Actions
- Index Batch Actions
- Custom Pages
- Arbre Components
- Authorization Adapter
Active Admin is a Ruby Gem.
gem 'activeadmin' # Plus integrations with: gem 'devise' gem 'cancan' # or cancancan gem 'draper' gem 'pundit'
More accurately, it’s a Rails Engine that can be injected into your existing Ruby on Rails application.
Setting up Active Admin
After installing the gem, you need to run the generator. Here are your options:
- If you don’t want to use Devise, run it with
rails g active_admin:install --skip-users
- If you want to use an existing user class, provide it as an argument:
rails g active_admin:install User
- Otherwise, with no arguments we will create an
AdminUserclass to use with Devise:
rails g active_admin:install
The generator adds these core files, among others:
Now, migrate and seed your database before starting the server:
rake db:migrate rake db:seed rails server
http://localhost:3000/admin and log in as the default user:
- User: firstname.lastname@example.org
- Password: password
Voila! You’re on your brand new Active Admin dashboard.
To register an existing model with Active Admin:
rails generate active_admin:resource MyModel
This creates a file at
app/admin/my_model.rb to set up the UI; refresh your browser to see it.
When upgrading to a new version, it’s a good idea to check the CHANGELOG.
To update the JS & CSS assets:
rails generate active_admin:assets
You should also sync these files with their counterparts in the AA source code:
If you use
will_paginate in your app, you need to configure an initializer for
Kaminari to avoid conflicts.
# config/initializers/kaminari.rb Kaminari.configure do |config| config.page_method_name = :per_page_kaminari end
If you are also using Draper, you may want to
per_page_kaminari is delegated correctly:
Draper::CollectionDecorator.send :delegate, :per_page_kaminari
If you’re getting the error
wrong number of arguments (6 for 4..5), read #2703.