Forum: Ruby-Forum.com NoMethodError in Store#add_to_cart

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
4c10c5480c8d1b9adc9dbef3751c6b28?d=identicon&s=25 Christi Merritt (crispy)
on 2007-09-18 14:07
Hello - I am new to not only Ruby but programing in general.  I have
been given this book "Agile Web Development with Rails" and told that it
will tell me everything I need to know.  I am completely lost.  I have
managed to get to page 99, but I have been stuck with this error for
days and since I have no knowledge of programing I don't know what to do
from here.  Can someone please help me.

 NoMethodError in Store#add_to_cart

Showing app/views/store/add_to_cart.rhtml where line #4 raised:

You have a nil object when you didn't expect it!
The error occurred while evaluating nil.items

Extracted source (around line #4):

1: <h1>Your Pragmatic Cart</h1>
2:
3: <ul>
4:   <% for cart_item in @cart.items %>
5:     <li><%= h(item.title) %></li>
6:   <% end %>
7: </ul>

Any help would be greatly appreciated.  I am sure this is a pretty
stupid question, but I have no clue what else to do but ask it!

crispy
This topic is locked and can not be replied to.