I’m having a strange issue where my select options are not remembered on submit (and validations fail, re-loading the form).
Here is my code
<%= form.select :state, options_for_select(us_states), :include_blank => true %>
Here is some of what us_states looks like:
def us_states
[
['Alabama', 'AL'],
['Alaska', 'AK'],
No matter what I select, it always picks to display the blank option in the select box. If I don’t use the :include_blank at all, it always just displays Alabama. So it’s just displaying the first field.
Specify the selected value by passing it as an argument to the
options_for_selecthelper.Documentation here.