你好,我是一個新的紅寶石在rails.I試圖保存在數據庫中選擇標記的值,但它不會被保存。有人可以告訴我我做錯了什麼。我是否正確使用表格中的選擇標籤選擇標記選項沒有被保存在數據庫
<%= link_to("Back" , {:action => 'rpage'}) %>
<%= form_for(:request , :url => {:action => 'servicecreate'}) do |f| %>
<div class="field">
<%= f.label :when %><br>
<%= f.text_field :when %>
</div>
<div class="field">
<%= f.label :where %><br>
<%= f.text_field :where %>
</div>
<div class="field">
<%= f.label :what %><br>
<%= f.text_field :what %>
</div>
<!--<%= f.select :category, @categories.each do |article| article end %>-->
<select name=:category>
<% @categories.each do |author| %>
<option value="<%= author %>"><%= author %></option>
<% end %>
</select>
<div class="field">
<%= f.label :negotiable %><br>
<%= f.text_field :negotiable %>
</div>
<div class="field">
<%= f.label :price %><br>
<%= f.text_field :price %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
改爲使用collection_select標記。 – sansarp 2015-03-08 17:12:43
你可以引用我的鏈接,我試圖瞭解它,但我不能 – Gardezi 2015-03-08 17:13:48