# Customizing Dashboards In order to customize which attributes get displayed for each resource, edit the dashboard file generated by the installation generator. By default, the file will look something like this: ```ruby require "administrate/dashboard/base" class CustomerDashboard < Administrate::Dashboard::Base ATTRIBUTE_TYPES = { id: Field::Integer, name: Field::String, email: Field::String, created_at: Field::DateTime, updated_at: Field::DateTime, orders: Field::HasMany, } COLLECTION_ATTRIBUTES = [ :id, :name, :email, :created_at, :updated_at, :orders, ] SHOW_PAGE_ATTRIBUTES = [ :id, :name, :email, :created_at, :updated_at, :orders, ] FORM_ATTRIBUTES = [ :name, :email, :orders, ] end ``` To change which attributes appear on each of the `index`, `show`, and `edit` pages, add or remove attributes to each constant array. Finally, the `ATTRIBUTE_TYPES` method defines how each attribute is displayed throughout the dashboard. There are a number of `Field` classes that you can specify, including: - `Field::BelongsTo` - `Field::Boolean` - `Field::DateTime` - `Field::Email` - `Field::HasMany` - `Field::HasOne` - `Field::Number` - `Field::Polymorphic` - `Field::Select` - `Field::String` - `Field::Text` ## Customizing Fields ### Setting Options Each of the `Field` types take a different set of options, which are specified through the `.with_options` class method: **Field::HasMany** `:limit` - Set the number of resources to display in the show view. Default is `5`. `:sort_by` - What to sort the association by in the show view. `:direction` - What direction the sort should be in, `:asc` (default) or `:desc`. **Field::Number** `:decimals` - Set the number of decimals to display. Defaults to `0`. `:prefix` - Prefixes the number with a string. Defaults to `""`. `:suffix` - Suffixes the number with a string. Defaults to `""`. For example, you might use the following to display U.S. currency: ```ruby unit_price: Field::Number.with_options( prefix: "$", decimals: 2, ) ``` Or, to display a distance in kilometers: ```ruby unit_price: Field::Number.with_options( suffix: " km", decimals: 2, ) ``` **Field::Select** `:collection` - Specify the array or range to select from. Defaults to `[]`. `:searchable` - Specify if the attribute should be considered when searching. Default is `true`. **Field::String** `:searchable` - Specify if the attribute should be considered when searching. Default is `true`. `:truncate` - Set the number of characters to display in the index view. Defaults to `50`. **Field::Text** `:searchable` - Specify if the attribute should be considered when searching. Default is `false`. `:truncate` - Set the number of characters to display in the index view. Defaults to `50`. ### Defining Labels To change the user-facing label for an attribute, define a custom I18n translation: ```yaml en: helpers: label: customer: name: Full Name ``` To change the labels used for resources in dashboard collections. Assume you have a users dashboard and you want to change "User #1" to "Testy McTesterson", the user's name. Add this method to the dashboard for Users. Use whatever attribute or method you like. Example for *user*: ````ruby def display_resource(user) user.name end ```` [define your own]: /adding_custom_field_types