我正在试图弄清楚如何更改标准的rails脚手架形式,以便它适用于嵌套模型。
所以这是交易:清单有很多检查。但是当我做标准的脚手架形式时:
<%= form_for(@check) do |f| %>
<% if @check.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@check.errors.count, "error") %> prohibited this check from being saved:</h2>
<ul>
<% @check.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :name %><br />
<%= f.text_field :name %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
我收到此错误(访问/ checklists / 1 / checks / new):
undefined method `checks_path' for #<#<Class:0x00000101795070>:0x000001017913a8>
Extracted source (around line #1):
1: <%= form_for(@check) do |f| %>
2: <% if @check.errors.any? %>
3: <div id="error_explanation">
我应该在这种形式下改变什么?