Is it possible to add an <option>
at the end of a <select>
created with the collection_select
helper method?
Right now I have
f.collection_select(:category_id , @categories, :id, :name, {:prompt => 'Please select a category'})
which generates
<select id="product_category_id" name="product[category_id]">
<option value="">Please select a category</option>
<option value="7">category one</option>
<option value="8">category 2</option>
</select>
and what I would like is
<select id="product_category_id" name="product[category_id]">
<option value="">Please select a category</option>
<option value="7">category one</option>
<option value="8">category 2</option>
<option value="new">..or create a new one</option>
</select>
Is this possible or should I just loop through the collection and generate the options manually?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…