administrate
administrate copied to clipboard
How to display has_many field name in edit/new dropdown
I have a basic relationship model where a venue has many categories through categorization. All good and dandy. However, I would like to show the names of the categories when editing/adding new venues.
How it currently looks:

My categories:

Is there a way, without having custom view files, to change this?
To answer my own question, you need to add a custom method in your dashboard of the model you need to change the display logic, like such:
def display_resource(your_model)
your_model.name # or whatever property you're trying to show
end
So in my case I added this in my category dashboard.
Source: https://github.com/thoughtbot/administrate/blob/master/docs/customizing_dashboards.md#defining-labels
Tip for future self: RTFM.