Reputation: 13705
I am using the Active Admin gem in my Rails app, and on one of my models admin page, there is a filter for an association to another model. The drop down menu is displaying #<Model:AxAAAAAA>
as opposed to the appropriate attribute.
For instance, if my model were posts, which belonged to users, on the posts admin index page, there would be a filter for users, and in the drop down menu for that filter would be id's such as #<User:abcd12345>
. I would like to be able to display something appropriate in the drop down menu for this filter. How can I do this with Active Admin?
UPDATE
As pointed out in the answer by ciastek, this is very similar to this question and in fact, I am also using "company_name" as an attribute instead of "name"
Upvotes: 2
Views: 3121
Reputation: 13705
I was able to solve my problem by passing :label_method => :company_name
to the resource in the resources.rb file under the 'admin' directory.
Upvotes: 2
Reputation: 1363
Simmilar to rails activeadmin drop down menu on new and edit forms, answer the same.
Upvotes: 1