Class: Comable::CartsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Comable::CartsController
- Defined in:
- app/controllers/comable/carts_controller.rb
Instance Method Summary collapse
Instance Method Details
#add ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/controllers/comable/carts_controller.rb', line 8 def add cart_item = Comable::Stock.where(id: params[:stock_id]).first cart_item ||= Comable::Product.where(id: params[:product_id]).first return redirect_by_product_not_found unless cart_item return redirect_by_product_not_found if cart_item.is_a?(Comable::Product) && cart_item.sku? current_customer.add_cart_item(cart_item, ) flash[:notice] = I18n.t('comable.carts.add_product') redirect_to cart_path end |
#show ⇒ Object
5 6 |
# File 'app/controllers/comable/carts_controller.rb', line 5 def show end |
#update ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/comable/carts_controller.rb', line 20 def update stock = Comable::Stock.where(id: params[:stock_id]).first return redirect_by_product_not_found unless stock current_customer.reset_cart_item(stock, ) flash[:notice] = I18n.t('comable.carts.update') redirect_to cart_path end |