-
Website
http://www.21apps.com/ -
Original page
http://www.21apps.com/agile/working-through-agile-web-development-with-rails-%e2%80%93-part-3/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
laurarogers
1 comment · 1 points
-
AndrewWoody
34 comments · 1 points
-
Zimmergren
2 comments · 1 points
-
prepbooks
1 comment · 4 points
-
deep_k_sharma
1 comment · 1 points
-
-
Popular Threads
-
Moving to BPOS: How we did it with the help of Amazon EC2
1 day ago · 4 comments
-
SharePoint 2010 Developer Training – Great week
2 weeks ago · 2 comments
-
Moving to BPOS: How we did it with the help of Amazon EC2
I noticed the author updated the code so it now reads on two lines:
current_item = CartItem.new(product)
@items << current_item
(I tried it on one line like you wrote but but I still have the error). The cart does get updated but I need to hit F5 to refresh the page. I noticed too in the add_to_cart function of store controller.rb (see below), if I use redirect_to_index then I can click on an image and it adds the product to my cart and renders it properly. However if I use the respond_to { |format| format.js} I get a page in safari that displays a try block with an enormous Element.update call.
def add_to_cart
begin
product = Product.find(params[:id])
rescue ActiveRecord::RecordNotFound
logger.error("Attempt to access invalid product #{params[:id]}")
redirect_to_index("Invalid Product")
else
@cart = find_cart
@current_item = @cart.add_product(product)
#respond_to { |format| format.js }
redirect_to_index
end
end