Reputation: 2470
When I click on Countries in rails_admin navigation I get
NameError in RailsAdmin::Main#index
uninitialized constant Country::Person
raise NameError.new("uninitialized constant #{candidates.first}", candidates.first)
I'm using User model but not Person. I think I need to configure it somehow. But where to do this?
here's my rails admin initializer
## == Devise ==
config.authenticate_with do
warden.authenticate! scope: :user
end
config.current_user_method(&:current_user)
## == Cancan ==
config.authorize_with :cancan
### More at https://github.com/sferik/rails_admin/wiki/Base-configuration
config.model "User" do
edit do
field :admin
field :username
field :email
field :password
end
end
config.actions do
dashboard # mandatory
index # mandatory
new
export
bulk_delete
show
edit
delete
show_in_app
## With an audit adapter, you can add:
# history_index
# history_show
end
Upvotes: 2
Views: 3102
Reputation: 4216
I had this issue too, but it wasn't caused by a lost association. I had incorrectly pluralized my model's name when I created it: it was Things
instead of Thing
.
I fixed it manually by changing the class name in things.rb
from Things
to Thing
and renaming the file to thing.rb
.
Upvotes: 5
Reputation: 2470
The problem was with my model. it used to be
class Country < ActiveRecord::Base
has_many :people
end
Upvotes: 4