2013-07-21 70 views
0

我有問題的id =「我型」添加到我的表格:添加ID形成,軌道

<tr> 
<%= form_for([@patient, @patient.treatments.build], :id => "my_form") do |f|%> 
<th><%= f.collection_select :category_id, Category.find(:all), :id, :typ %></th> 
<th><%= f.text_field :content , :id => "inputbox"%></th> 
<th><%= f.text_field :day, :value => Date.today %></th> 
<th><%= f.submit :class => 'btn btn-small btn-primary searsa'%></th> 
<% end %> 
</tr> 

你會怎麼做呢?我也試過:

<%= form_for, :id => "my_form"([@patient, @patient.treatments.build]) do |f|%> 

回答

2

請嘗試:

<%= form_for([@patient, @patient.treatments.build], :html => { :id => "my_form" }) do |f|%> 
+0

是的作品!謝謝! –