I'm using Rails 4.2.3. I would like to construct a select menu in my form, in which both the name and value are the same option and I would like to construct the options from an array. I tried this
<%= f.collection_select :unit, options_for_select([['km'], ['mi']]) %>
but got the error
wrong number of arguments (given 2, expected 4..6)
How do I construct the above properly? I would like there to be an additional option with a blank value that reads "Select Unit".
Thanks, - Dave
You should use the select
method instead of the collection_select
<%= f.select :unit, [['km', 'km'], ['mi', 'mi']] %>