I’ve been working my way through the book and I’m stuck on page 124. I’ve added in the code below.
Now when I test it, instead of adding a new item to the existing cart it creates a new cart each time. Could anyone give me any pointers? I’ve checked the code through the book a couple of times and can’t see anything obvious I’ve missed.
Your Pragmatic Cart
<% @cart.line_items.each do |item| %>
- <%= item.product.title %> <% end %>