I am following the book very closely and I am up to ITERATION C2 : A SMARTER CART (page 113). I have just made the changes to the add_to_cart.html.erb and I now get:
NoMethodError in Store#add_to_cart Showing store/add_to_cart.html.erb where line #4 raised: You have a nil object when you didn't expect it! The error occurred while evaluating nil.quantity Extracted source (around line #4): 1: <h1>Your Pragmatic Cart</h1> 2: <ul> 3: <% for item in @cart.items %> 4: <li><%= item.quantity %> × <%=h item.title %></li> 5: <% end %> 6: </ul> RAILS_ROOT: /Users/Steve/rails/depot Application Trace | Framework Trace | Full Trace app/views/store/add_to_cart.html.erb:4:in `_run_erb_47app47views47store47add_to_cart46html46erb' app/views/store/add_to_cart.html.erb:3:in `each' app/views/store/add_to_cart.html.erb:3:in `_run_erb_47app47views47store47add_to_cart46html46erb'
So I continued on and tried the “rake db:sessions:clear”, still get the error. I have been over and over the code and I can’t see whats wrong.
Please put me right!