Reputation: 1199
Through select_tag
i want to add a default option as select a category
here is my code
<%= select_tag 'category', options_from_collection_for_select(@categories, 'id', 'name', :onchange => 'update_subscategories_div(this.value)'%>
Upvotes: 0
Views: 519
Reputation: 33542
You can use prompt
option of select_tag
<%= select_tag 'category', options_from_collection_for_select(@categories, 'id', 'name'), prompt: "Select a Category", :onchange => 'update_subscategories_div(this.value)' %>
Upvotes: 1