From 2fa860e5f607da307570df75cf57b3684f82e23c Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Thu, 25 Feb 2021 18:10:21 -0300 Subject: [PATCH] Clarify how extra options are sent down to the Rails collection helpers Simple Form passes down all unrecognized options directly to the Rails helpers so you can customize how they're used, but that wasn't super clear in the Readme, this improves it a bit. Related to #1728. [ci skip] --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8b825549..dca19605 100644 --- a/README.md +++ b/README.md @@ -326,14 +326,13 @@ If you want to change this behavior you must make it explicit, like this: <% end %> ``` -All other options given are sent straight to the underlying helper. For example, you can give prompt as: +All other options given are sent straight to the underlying Rails helper(s): [`collection_select`](http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#method-i-collection_select), [`collection_check_boxes`](http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#method-i-collection_check_boxes), [`collection_radio_buttons`](http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#method-i-collection_radio_buttons). For example, you can pass `prompt` and `selected` as: ```ruby f.input :age, collection: 18..60, prompt: "Select your age", selected: 21 ``` -Extra options are passed into helper [`collection_select`](http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#method-i-collection_select). -You may also find it useful to explicitly pass a value to the optional `:selected`, especially if passing a collection of nested objects. +It may also be useful to explicitly pass a value to the optional `:selected` like above, especially if passing a collection of nested objects. It is also possible to create grouped collection selects, that will use the html *optgroup* tags, like this: