我对 Rails 很陌生,正在尝试使用 <%= render 'form' %> 将此表单包含在帖子/索引中
<%= form_for(@post) do |post_form| %>
<% if @post.errors.any? %>
<div id="errorExplanation">
<h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2>
<ul>
<% @post.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<%= post_form.label :name %>: <%= post_form.text_field :name %>
<br/>
<%= post_form.label :subject %>: <%= post_form.text_field :subject %>
<br/>
<%= post_form.label :email %>: <%= post_form.text_field :email %>
<br/>
<%= post_form.label :content %>: <%= post_form.text_area :content %>
<%= post_form.submit %>
导致的错误说 NilClass:Class 的未定义方法“model_name”