I cannot seem to find any documentation on how to modify the administrate gem's default dashboards in order to customize what gets displayed in the index and show pages. Here's my specific goal:
- Given that an
Articlebelongs_toanAuthor - When I create an Article
- I want to see the Author's last name in the dropdown list for the associated field
- And once saved, I want to see the Author's last name in the Article's index and show pages
Right now, instead, I get a not-so-useful "Author #4" as the record label. Here's the automatically generated dashboard:
class ArticleDashboard < Administrate::BaseDashboard
ATTRIBUTE_TYPES = {
author: Field::BelongsTo,
id: Field::Number,
title: Field::String,
content: Field::Text,
created_at: Field::DateTime,
updated_at: Field::DateTime,
}.freeze
[snip]
end
The "Customizing Dashboard" documentation page says:
Each of the Field types take a different set of options, which are specified through the
.with_optionsclass method.
So I figure that calling with_options on Field::BelongsTo might be the way to go, but what options are available for that field (or for any other, for that matter)?