From dd1c4c1cfe221e5b07c709225685565d210419e4 Mon Sep 17 00:00:00 2001 From: "Butler, Alexis (UG - Computer Science)" <ab02259@surrey.ac.uk> Date: Sat, 28 Nov 2020 10:54:13 +0000 Subject: [PATCH] Passed carts contoller tests --- app/controllers/carts_controller.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/carts_controller.rb b/app/controllers/carts_controller.rb index a36fbd5..aceed8b 100644 --- a/app/controllers/carts_controller.rb +++ b/app/controllers/carts_controller.rb @@ -9,7 +9,8 @@ class CartsController < ApplicationController item["Num"] += 1 cart[prod_id] = item update_cart cart - redirect_back fallback_location: :root_url + flash[:success] = "Item added to cart" + redirect_back fallback_location: :root end end @@ -21,6 +22,7 @@ class CartsController < ApplicationController cart[prod_id] = item cart.delete(prod_id) if item["Num"] < 1 update_cart cart - redirect_back fallback_location: :root_url + flash[:success] = "Item removed from cart" + redirect_back fallback_location: :root end end -- GitLab