Ruby on rails 使用Rails 4 ActionView::Template进行敏捷Web开发:未定义的局部变量或方法产品 我是一名Ruby新手,我正在学习《Rails 4的敏捷开发》,第95页 我创建了第二个存储控制器,并得到以下错误:未定义的局部变量或方法“products”。有人知道少了什么

Ruby on rails 使用Rails 4 ActionView::Template进行敏捷Web开发:未定义的局部变量或方法产品 我是一名Ruby新手,我正在学习《Rails 4的敏捷开发》,第95页 我创建了第二个存储控制器,并得到以下错误:未定义的局部变量或方法“products”。有人知道少了什么,ruby-on-rails,Ruby On Rails,看法 实用目录 类StoreController

看法


实用目录 类StoreController

应该是

<span class="price"><%= product.price %></span>


你好,伊恩,谢谢你的提示。我更正了错误,但是如果我启动服务器,错误通知仍然存在:否,它说:nil:nilclass的未定义方法'each',否,它正在工作,我再次保存了每个页面。谢谢你,伊恩!
<span class="price"><%= products.price %></span>
<span class="price"><%= product.price %></span>