grouped_options_for_select() has a prompt option to set the text of a default option for the select element but it doesn’t allow setting its value.
Allowing a prompt value would be useful in cases where the default option is not an empty string.
It could be set as a different option like prompt_value or we could also accept an array on prompt with [text, value] like [“Please select an option”, “default_value”].
The prompt option takes a boolean or a string. Here’s the docs:
Options:
:prompt - set to true or a prompt string. When the select element doesn’t have a value yet, this prepends an option with a generic prompt - “Please select” - or the given prompt string.