我正在尝试使用一个表单编辑多条记录,因此用户可以编辑几条记录,然后在最后而不是在每个单独的记录之后按提交。我已经发布了我当前的代码,我收到了这个错误:
undefined method `connection_connection_path'
控制器
def show
@customer = Customer.find(params[:id])
@connection = @customer.connections
respond_to do |format|
format.html # show.html.erb
format.json { render json: @customer }
end
end
看法
<table class="table">
<thead>
<th>Interface</th>
<th>Device</th>
<th>Speed</th>
<th>Site</th>
<th>Capable</th>
<th>Notes</th>
</thead>
<%= form_for(@connection) do |f| %>
<% @connection.each do |l| %>
<tr>
<td><%= l.interface %></td>
<td><%= l.device %></td>
<td><%= l.speed %></td>
<td><%= l.site.name%> </td>
<td><%= f.check_box :check %></td>
<td><%= f.text_field :notes %></td>
</tr>
<% end %>
<tr><%= f.submit %></tr>
</table>
<% end %>
路线
resources :connections
resources :sites
resources :customer_sites
resources :customers
root :to => "customers#index"