Thursday 19 January 2017

Active Admin

Active Admin is a Ruby on Rails plugin for creating and managing admin page.
The available gem can be included in the gem file like this:
gem 'activeadmin'

Run bundle install to install the gem into your rails application.
In the terminal, run:
rails generate active_admin:install
Migrate the database after installation:
rake db:migrate
Run rake db:seed because active admin adds username and password for first the admin in seed.rb file. The first admin can then add more admins.

Some may face following issues while running bundle install:

Your bundle requires gems that depend on each other, creating an infinite loop. Please remove gem 'meta_search' and try again. 
Solution: Replace
gem 'activeadmin'
with
gem 'activeadmin', github: 'activeadmin'
Or, something like this: 
 
Bundler could not find compatible versions for gem "actionpack":
  In snapshot (Gemfile.lock):
    actionpack (= 5.0.1)
  In Gemfile:
    activeadmin was resolved to 1.0.0.pre4, which depends on
      inherited_resources (~> 1.6) was resolved to 1.6.0, which depends on
        actionpack (< 5, >= 3.2)

    activeadmin was resolved to 1.0.0.pre4, which depends on
      inherited_resources (~> 1.6) was resolved to 1.6.0, which depends on
        actionpack (< 5, >= 3.2)

    rails (>= 5.0.0.1, ~> 5.0.0) was resolved to 5.0.1, which depends on
      actionpack (= 5.0.1)

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
Solution: Add this in your gem file
gem 'inherited_resources', github: 'activeadmin/inherited_resources'