Possible book error
28 Jan 2013, 02:53
Adrian Lee Elder (9 posts)
The book uses the code:
However, when the button “Add to Cart” is clicked, the row count is increased to two (if the cart is already empty). If we look at _cart.html.erb, we find that this renders the line item via the partial, then displays the total line row (both table rows).
Summary: If the line item + the total line rows are displaying, then wouldn’t we need to change the = 1 to = 2? Because the total number of rows on click would instantly be two.
The = 2 fixed the cart not displaying when I hit add to cart for the first time. Spent several hours trying to see if it was just me missing something. I could still be following the book wrong, feed back would be appreciated.
|You must be logged in to comment|