gregbell/active_admin — Issue #1035: What am I doing wrong here? Namespace config throwing exceptions
Author: chanced
Created: 2012-02-17 23:21:58+00:00
State: open

I think my confusion is a byproduct of old documentation/blogs and just traditional ignorance but I'm havin' issues with namespaced configs.

So as it stands right now, I have the following structure:
> ▾ app/
> ▾ admin/
> agents.rb
> dashboards.rb
> ▾ agency/
> agents.rb
> dashboards.rb

I don't see a means to set a namespace within the dashboards so as of right now they are both essentially:

```ruby
ActiveAdmin::Dashboards.build do
end
```
The agents have the following declarations:
```ruby
ActiveAdmin.register Agent, :namespace=>:agency_admin do
```
and
```ruby
ActiveAdmin.register Agent, :namespace=>:admin do
```
This all works fine with a default config. I can pull up /agency_admin/agents or /admin/agents just fine. However, as soon as I add a config such as what comes commented out as an example within the initializer:
```ruby
config.namespace :admin do |admin|
admin.site_title = "Custom Admin Title"
end
```
I get the following exception stream when starting the server:

> /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/bundler/gems/active_admin-bbdbadafe5d7/lib/active_admin/namespace.rb:191:in `eval': undefined method `devise' for # (NoMethodError)
>	from /Users/chance/code/rails/nokr/app/models/user.rb:36:in `'
>	from /Users/chance/code/rails/nokr/app/models/user.rb:1:in `'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:456:in `load'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:456:in `block in load_file'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:640:in `new_constants_in'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:455:in `load_file'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:342:in `require_or_load'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:489:in `load_missing_constant'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:181:in `block in const_missing'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:179:in `each'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:179:in `const_missing'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/ext/module.rb:36:in `const_missing'
>	from /Users/chance/code/rails/nokr/app/helpers/user/addresses_helper.rb:1:in `'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:456:in `load'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:456:in `block in load_file'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:640:in `new_constants_in'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:455:in `load_file'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:342:in `require_or_load'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:302:in `depend_on'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:214:in `require_dependency'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/actionpack-3.1.1/lib/abstract_controller/helpers.rb:135:in `block in modules_for_helpers'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/actionpack-3.1.1/lib/abstract_controller/helpers.rb:131:in `map!'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/actionpack-3.1.1/lib/abstract_controller/helpers.rb:131:in `modules_for_helpers'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/actionpack-3.1.1/lib/action_controller/metal/helpers.rb:89:in `modules_for_helpers'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/actionpack-3.1.1/lib/abstract_controller/helpers.rb:95:in `helper'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/actionpack-3.1.1/lib/action_controller/railties/paths.rb:17:in `block (2 levels) in with'
>	from /Users/chance/code/rails/nokr/app/controllers/application_controller.rb:1:in `'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:456:in `load'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:456:in `block in load_file'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:640:in `new_constants_in'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:455:in `load_file'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:342:in `require_or_load'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:489:in `load_missing_constant'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:181:in `block in const_missing'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:179:in `each'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:179:in `const_missing'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/ext/module.rb:36:in `const_missing'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/inherited_resources-1.2.2/lib/inherited_resources/base.rb:14:in `'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/inherited_resources-1.2.2/lib/inherited_resources/base.rb:4:in `'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/bundler/gems/active_admin-bbdbadafe5d7/lib/active_admin/base_controller/menu.rb:2:in `'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/bundler/gems/active_admin-bbdbadafe5d7/lib/active_admin/base_controller/menu.rb:1:in `'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `block in require'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `block in load_dependency'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:640:in `new_constants_in'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `load_dependency'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/bundler/gems/active_admin-bbdbadafe5d7/lib/active_admin/base_controller.rb:2:in `'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/bundler/gems/active_admin-bbdbadafe5d7/lib/active_admin/resource_controller/actions.rb:2:in `'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/bundler/gems/active_admin-bbdbadafe5d7/lib/active_admin/resource_controller/actions.rb:1:in `'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `block in require'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `block in load_dependency'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:640:in `new_constants_in'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `load_dependency'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/bundler/gems/active_admin-bbdbadafe5d7/lib/active_admin/resource_controller.rb:2:in `'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/bundler/gems/active_admin-bbdbadafe5d7/lib/active_admin/dashboards/dashboard_controller.rb:3:in `'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/bundler/gems/active_admin-bbdbadafe5d7/lib/active_admin/dashboards/dashboard_controller.rb:2:in `'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/bundler/gems/active_admin-bbdbadafe5d7/lib/active_admin/dashboards/dashboard_controller.rb:1:in `'
>	from (eval):1:in `generate_dashboard_controller'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/bundler/gems/active_admin-bbdbadafe5d7/lib/active_admin/namespace.rb:191:in `eval'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/bundler/gems/active_admin-bbdbadafe5d7/lib/active_admin/namespace.rb:191:in `generate_dashboard_controller'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/bundler/gems/active_admin-bbdbadafe5d7/lib/active_admin/namespace.rb:43:in `initialize'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/bundler/gems/active_admin-bbdbadafe5d7/lib/active_admin/application.rb:110:in `new'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/bundler/gems/active_admin-bbdbadafe5d7/lib/active_admin/application.rb:110:in `find_or_create_namespace'
>	from /Users/chance/code/rails/nokr/config/initializers/active_admin.rb:39:in `block in '
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/bundler/gems/active_admin-bbdbadafe5d7/lib/active_admin.rb:70:in `setup'
>	from /Users/chance/code/rails/nokr/config/initializers/active_admin.rb:1:in `'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:234:in `load'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:234:in `block in load'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `block in load_dependency'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:640:in `new_constants_in'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `load_dependency'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:234:in `load'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/engine.rb:556:in `block (2 levels) in '
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/engine.rb:555:in `each'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/engine.rb:555:in `block in '
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/initializable.rb:30:in `instance_exec'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/initializable.rb:30:in `run'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/initializable.rb:55:in `block in run_initializers'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/initializable.rb:54:in `each'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/initializable.rb:54:in `run_initializers'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/application.rb:96:in `initialize!'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/railtie/configurable.rb:30:in `method_missing'
>	from /Users/chance/code/rails/nokr/config/environment.rb:5:in `'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `block in require'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `block in load_dependency'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:640:in `new_constants_in'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `load_dependency'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require'
>	from /Users/chance/code/rails/nokr/config.ru:4:in `block in

'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/rack-1.3.3/lib/rack/builder.rb:51:in `instance_eval'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/rack-1.3.3/lib/rack/builder.rb:51:in `initialize'
>	from /Users/chance/code/rails/nokr/config.ru:1:in `new'
>	from /Users/chance/code/rails/nokr/config.ru:1:in `

'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/rack-1.3.3/lib/rack/builder.rb:40:in `eval'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/rack-1.3.3/lib/rack/builder.rb:40:in `parse_file'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/rack-1.3.3/lib/rack/server.rb:200:in `app'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/commands/server.rb:46:in `app'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/rack-1.3.3/lib/rack/server.rb:301:in `wrapped_app'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/rack-1.3.3/lib/rack/server.rb:252:in `start'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/commands/server.rb:70:in `start'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/commands.rb:54:in `block in '
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/commands.rb:49:in `tap'
>	from /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/commands.rb:49:in `'
>	from script/rails:6:in `require'