Using rails_admin to display a dropdown on a bind_to association

I am using rails_admin to manage data in a rails application.

I have this class:

 class Activity < ActiveRecord::Base attr_accessible :content, :title, :category_id belongs_to :category, :inverse_of => :activities end 

And the other end:

 class Category < ActiveRecord::Base attr_accessible :title, :category_id, :activities_ids has_many :activities, :inverse_of => :category end 

My rails_admin initializer for Activity is as follows:

 config.model Activity do edit do field :title field :content, :text do bootstrap_wysihtml5 true end field :category end end 

Now in the form, it displays the category as follows:

Missing field

It is assumed that category names will be displayed, right? What am I missing here?

+6
source share
1 answer

I have been looking for this for quite some time. To get a really nice autocomplete drop-down menu, just add:

 config.model Activity do edit do field :category, :belongs_to_association end end 
+5
source

All Articles