From 02b2c6bacf5256a71cef235be580f829ed517e90 Mon Sep 17 00:00:00 2001 From: Jose Varela Date: Fri, 15 Jul 2022 19:11:00 -0500 Subject: [PATCH] Document how to customize Field::Select option labels --- docs/customizing_dashboards.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/customizing_dashboards.md b/docs/customizing_dashboards.md index e4b09393a9..d7f68e4e05 100644 --- a/docs/customizing_dashboards.md +++ b/docs/customizing_dashboards.md @@ -221,6 +221,17 @@ objects to display as. `:collection` - Specify the options shown on the select field. It accept either an array or an object responding to `:call`. Defaults to `[]`. +To customize option labels, pass an array of pairs where the first element is the value submitted with the form and the second element is the label shown to the user. + +For example: + +```ruby + currency = Field::Select.with_options( + collection: [ ['usd', 'Dollar'], ['eur', 'Euro'], ['yen', 'Yen'] ] + ) + +``` + `:searchable` - Specify if the attribute should be considered when searching. Default is `true`.