Active Admin has an opinionated way of showing associations that works excellent as long as the association has a field called name. I know there's a way to tell Active Admin which field to show from the associated file but I cannot find it anywhere in the documentation.
I have a model called app_label_translation that belongs_to app_label. app_label has a field called label that I'd like Active Admin treat as it would a field named name.
As a work-around I'm doing this:
index do
selectable_column
id_column
column :app_label, sortable: "app_labels.label" do |a|
link_to a.app_label.label admin_app_label_path(a.app_label)
end
end
Does anyone know the command to override name with a field of your choice?
Update: I'm using a slightly better work-around now by having alias_attribute :name, :label in my app_label model. This allows active admin to do its thing with label. I still think there's a better way to do this.