我正在做Rails 入门教程,当我从 shell 运行本地服务器时,我得到了这个:
`NoMethodError in Posts#new` `/_form.html.erb where line #1 raised:
`undefined method `model_name' for NilClass:Class
那是提取的源代码(在第 1 行附近):
1: <%= form_for @post do |f| %>
2: <% if @post.errors.any? %>
3: <div id="errorExplanation">
4: <h2><%= pluralize(@post.errors.count, "error") %> prohibited
我刚开始使用 Ruby on Rails,但不知道发生了什么。我究竟做错了什么?