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.
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' end
That should be enough, although they (devs) recommend to install
meta_search library too.
Now, first thing our application needs is
ActiveAdmin.setup do |config| config.site_title = "Application Name" config.authentication_method = false config.current_user_method = false config.allow_comments = false end
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
# ... class Application < Rails::Application config.assets.precompile += ['active_admin.css', 'active_admin.js'] end # ...
Now, add active admin routes
YourApp::Application.routes.draw do ActiveAdmin.routes(self) end
Start application and you're good to go. Documentation covers pretty much everything else at this point.