25 Oct 2013, 18:23
Generic-user-small

Robin Ouyang (2 posts)

Hello,

I finished the Iteration F2: Creating an Ajax-Based Cart. But after I clicked to Add to Cart button, the cart div disappeared. There seems no error in the log.

Started POST "/line_items?product_id=1" for 127.0.0.1 at 2013-10-26 02:13:32 +0800
Processing by LineItemsController#create as JS
  Parameters: {"authenticity_token"=>"GQ0QDNDknCeGIQ/UYrW6bFa0XdTnHIP7wcWVyYFL8ro=", "product_id"=>"1"}
  Cart Load (0.3ms)  SELECT "carts".* FROM "carts" WHERE "carts"."id" = ? LIMIT 1  [["id", 21]]
  Product Load (0.2ms)  SELECT "products".* FROM "products" WHERE "products"."id" = ? ORDER BY title LIMIT 1  [["id", "1"]]
  LineItem Load (0.1ms)  SELECT "line_items".* FROM "line_items" WHERE "line_items"."cart_id" = ? AND "line_items"."product_id" = 1 ORDER BY "line_items"."id" ASC LIMIT 1  [["cart_id", 21]]
   (0.1ms)  begin transaction
  SQL (0.3ms)  UPDATE "line_items" SET "quantity" = ?, "updated_at" = ? WHERE "line_items"."id" = 38  [["quantity", 4], ["updated_at", Fri, 25 Oct 2013 18:13:32 UTC +00:00]]
   (221.9ms)  commit transaction
  LineItem Load (0.3ms)  SELECT "line_items".* FROM "line_items" WHERE "line_items"."cart_id" = ?  [["cart_id", 21]]
  Product Load (0.3ms)  SELECT "products".* FROM "products" WHERE "products"."id" = ? ORDER BY title LIMIT 1  [["id", 1]]
  Rendered line_items/_line_item.html.erb (7.2ms)
  Rendered carts/_cart.html.erb (13.1ms)
  Rendered line_items/create.js.erb (16.7ms)
Completed 200 OK in 252ms (Views: 20.6ms | ActiveRecord: 223.4ms)
25 Oct 2013, 18:32
Generic-user-small

Robin Ouyang (2 posts)

I found my typo. Please ignore this. T.T

  You must be logged in to comment