Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Undefined method `config' installing active_admin inside a mountable engine in Rails 3.2 #1655

brendon opened this Issue · 3 comments

2 participants


I'm getting the following error when trying to install active_admin inside a Rails engine:

/gems/activeadmin-0.5.0/lib/active_admin.rb:84:in `use_asset_pipeline?': undefined method `config' for nil:NilClass (NoMethodError)

Engines don't have any configuration files of their own so perhaps this is what it causing it?

Is installing active_admin inside an engine supported?


Hilariously realised that my 'engine' was basically doing what active_admin was about to do, so I could do away with my engine altogether. I'll close this, but I'm not sure if someone else wants to look into using active_admin as the admin part of a greater engine?

@brendon brendon closed this

You can get around this by creating /lib/active_admin.rb:

module ActiveAdmin
  def self.use_asset_pipeline?
    true # or false if you don't want active admin to use the asset_pipeline with the engine

And updating /script/rails like this:

#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.

ENGINE_ROOT = File.expand_path('../..', __FILE__)
ENGINE_PATH = File.expand_path('../../lib/<engine_name>/engine', __FILE__)

require "#{ENGINE_ROOT}/lib/active_admin" #
require 'rails/all'
require 'rails/engine/commands'

However, that only gets the active admin installation script to run. You then have to undo all this to get active admin working within the app

Then to get the test/dummy app to run:

Add require to /config/initializers/active_admin.rb

require 'active_admin'

And disable 'ActiveAdmin.routes(self)' in your engine's routes file, which means you'll need to configure admin routes manually or possibly via:

mount ActiveAdmin::Engine => "/admin"

Which at least doesn't raise errors.

However, I think the main message from this is that it isn't straight forward to have active admin running within another engine.


Haha! Yes, you're right there. I managed to create a nice little admin interface running on an isolated host domain name by using some clever routing. Works like a treat and means that I don't need to run a separate rails app for my admin interface, the router determines whether to serve up a clients site (my product is a multi-tenant CMS), or my admin interface for managing clients, and a rack middleware decides on which databases to use for the connection :)

Thanks heaps for your thorough investigation though! :)

Have a great day!


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.