你好,我是一个新的红宝石在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