I'm using simple_form
to submit a form with multiple fields and some dropdown values. When the form is rendered with errors, all text fields are remembered, but some of the dropdown values are resetted. All values are permitted in strong params, and pass validate_presence_of
validation.
The collections are created in my model using class methods. As follows:
def self.options
['One','Two','Three']
end
And loaded in my form using:
<%= f.input :dropdown, collection: MyModel.options, include_blank: false %>
What should I do correctly render the form object when it is returned with errors?
f.select :dropdown, MyModel::myoptions, {include_blank: false}
And the method should be like this
def self.myoptions
[["One","One"],["Two","Two"],["Three","Three"]]
end
Please try and let me know.