jerry520123 2009-02-01 09:40
浏览 197
已采纳

按照敏捷开发书中做到这个步骤实在不行了。

Showing app/views/store/add_to_cart.html.erb where line #3 raised:
You have a nil object when you didn't expect it!
The error occurred while evaluating nil.items
Extracted source (around line #3):
1:

Your Pragmatic Cart


2:

    3: <% for item in @Cart.items %>
    4:
  • <%=h (item.title) %>

  • 5: <% end %>
    6:

RAILS_ROOT: /root/rubygems/web
Application Trace | Framework Trace | Full Trace
app/views/store/add_to_cart.html.erb:3

Request
Parameters:
{"authenticity_token"=>"a4317573b763d4a8525f2a76762c5d5c74859b84",
"id"=>"14"}

Show session dump

flash: !map:ActionController::Flash::FlashHash {}

Response
Headers:
{"cookie"=>[],
"Content-Type"=>"text/html",
"Cache-Control"=>"no-cache"}

  • 写回答

1条回答 默认 最新

  • hexawing 2009-02-01 22:05
    关注

    这个“@Cart”换成“@cart”试试呢?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作