Store#index中的NoMethodError

时间:2013-03-22 10:47:14

标签: ruby-on-rails-3

我收到以下错误,请任何人查看它并帮助我摆脱这个.. 实际上这是我的development.log文件中显示的错误。

ActionView::Template::Error (undefined method `quantity' for #<LineItem:0xaa47b1c>):
4: <tr>
5: <% end %>
6: <tr>
7: <td><%= line_item.quantity %>&times;</td>
8: <td><%= line_item.product.title %></td>
9: <td class="item_price"><%= number_to_currency(line_item.total_price) %></td>
10: </tr>
  app/views/line_items/_line_item.html.erb:7:in `_app_views_line_items__line_item_html_erb___826332857_89103730'
  app/views/carts/_cart.html.erb:4:in `_app_views_carts__cart_html_erb___185026047_87767060'
  app/views/layouts/application.html.erb:19:in `_app_views_layouts_application_html_erb___370633105_87583010'
  app/helpers/application_helper.rb:6:in `hidden_div_if'
  app/views/layouts/application.html.erb:18:in `_app_views_layouts_application_html_erb___370633105_87583010'

1 个答案:

答案 0 :(得分:0)

错误非常明确:您的LineItem类没有名为quantity的方法(或数据库字段)。