gregbell/active_admin — Issue #1112: NameError (uninitialized constant) for a Namespace model
Author: nazarhussain
Created: 2012-03-07 11:39:30+00:00
State: open

Hi,

I have a model like this.

````
class Classifieds::Category < ActiveRecord::Base
belongs_to :parent , :class_name=>"Classifieds::Category", :foreign_key=>'parent_id'
end
````

and a active_admin file like this

```
ActiveAdmin.register Classifieds::Category do
menu :label=>'Classifieds Categories'
end
```

it is generating this error

````
NameError (uninitialized constant Classifieds::Category):
app/admin/classifieds_categories.rb:1:in `'
config/routes.rb:5:in `block in '
config/routes.rb:1:in `'

Rendered /home/nazar2/.rvm/gems/ruby-1.9.2-p290@3.2/gems/actionpack-3.2.2/lib/action_dispatch/middleware/templates/rescues/_trace.erb (2.9ms)
Rendered /home/nazar2/.rvm/gems/ruby-1.9.2-p290@3.2/gems/actionpack-3.2.2/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.4ms)
Rendered /home/nazar2/.rvm/gems/ruby-1.9.2-p290@3.2/gems/actionpack-3.2.2/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (13.6ms)
```

How can we fix this. I had tested it in console it is working fine.