small medium large xlarge

Generic-user-small
30 Nov 2009, 03:31
Anthony Rocco (2 posts)

Ive checked and double checked my code and it seems perfect, yet for some reason, my store refuses to render the shopping cart items. It will show the shopping cart total and update it fine, but the items and quanities are lost somehow. Its almost as if it is refusing to render the _cart_item.html.erb partial.

But I’ve checked the links and they are written correctly. I’ve deleted cookies, reset the session, and restarted the server to no avail. Any other ideas on how to troubleshoot this?

Thanks in advance,

Anthony

Generic-user-small
30 Nov 2009, 14:43
Anthony Rocco (2 posts)

Took a fresh look at it this morning and found the problem. It was in this simple line in the _cart.html.erb partial:

<% render(:partial => “cart_item”, :collection => cart.items) %>

For those out there transcribing the book code by hand, be careful. The correct line is this:

<%= render(:partial => “cart_item”, :collection => cart.items) %>

This is why the code was running and the total updating, but the partial was never rendering in the view.

You must be logged in to comment