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

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"}

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