Class: Gemstonemerchant::CartController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Gemstonemerchant::CartController
- Defined in:
- app/controllers/gemstonemerchant/cart_controller.rb
Instance Method Summary collapse
Instance Method Details
#add ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/gemstonemerchant/cart_controller.rb', line 11 def add @cart.save session[:cart_id] = @cart.id product = Product.find(params[:id]) item = LineItem.new item.make_items(@cart.id, product.id, product.base_price) @cart.recalculate_price! flash[:notice] = "Product Added to Cart" redirect_to cart_path end |
#remove ⇒ Object
22 23 24 25 26 27 28 |
# File 'app/controllers/gemstonemerchant/cart_controller.rb', line 22 def remove item = @cart.line_items.find(params[:id]) item.destroy @cart.recalculate_price! flash[:notice] = "Product Deleted from Cart" redirect_to cart_path end |
#show ⇒ Object
8 9 |
# File 'app/controllers/gemstonemerchant/cart_controller.rb', line 8 def show end |