How can I specify a select element’s label using simpleform?
A while ago, I answered this question on stack overflow, and would like to expand on it here.
For reference, the SimpleForm gem is a nice alternative to the Rails form builder. It’s an excellent gem, and can be used to easily create any type of form element.
By default it derives its input labels from a backing model. However, it can be used without a model.
While you can create a select element without a backing model, this functionality is poorly documented.
In case anyone else runs into this, this is how to create a dropdown that contains “Black” and “Yellow” in SimpleForm without a model
Which produces the following output:
I hope this helps.