I need to produce a select menu with a Default value on the list of <options>
. Here is how I need it looks like.
<select name="menu[parent_id]" id="menu_parent_id">
<option value="0">==None==</option>
<option value="34">TEST</option>
</select>
Currently I use this select
helper in my form
<%= f.select(:parent_id, @parent_menus.collect {|p| [ p.name, p.id ] }, {:include_blank => '==None=='})%>
the above code produce this; (value=""
)
<select name="menu[parent_id]" id="menu_parent_id">
<option value="">==None==</option>
<option value="34">TEST</option>
</select>
Does anyone here can show me a way to add value="0"
to the options list?
<%= f.select(:parent_id, [["==None==", 0]] + @parent_menus.collect {|p| [ p.name, p.id ] }) %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With