I don’t have an answer to your problem, but I think mine is related. The Ajax-part itself works without a problem. The problems start when I add the Highlight (Iteration D3). The highlight works the first time I press the “Add to cart”-button. Pressing it again (or another “Add to cart”-button for that matter) changes nothing. It’s still as if only 1 thing has been added to the cart. Reloading the page shows that the 2nd item has been added too.
When checking the output from Mongrel I get this:
ActionView::TemplateError (You have a nil object when you didn’t expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.) on line #1 of app/views/store/_cart_item.html.erb:
1: <% if cart_item == @current_item %>
2: <tr id="current_item">
3: <% else %>
Rendered rescues/_trace (67.5ms)
Rendered rescues/_request_and_response (0.3ms)
Rendering rescues/layout (internal_server_error)
I’ve checked all my code and it’s the same as in the book or as in the files online and it works the first time so I have no idea what’s causing it.
btw: I’ve got Rails 2.3.4