Reputation: 43666
I am using simple_form gem in order to create my forms. In one case, I am using "collection" method in order to build a select input element.
What I want, is to set a default text of this "drop down" as a selected option, but the option should not be selected.
For example, if I have a languages list, I want to have a selected options with text "Select language". It's should not be selected as well, in order for validates:presence of the field to work.
Upvotes: 1
Views: 2545
Reputation: 958
:prompt option is responsible for that.
= simple_form_for :user do |f|
= f.input :lang, collection: ["Ru", "En"], prompt: "Select language"
Upvotes: 4