Class: Comable::CartsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Comable::CartsController
- Defined in:
- app/controllers/comable/carts_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#add ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'app/controllers/comable/carts_controller.rb', line 6 def add if current_comable_user.add_cart_item(@cart_item, ) redirect_to comable.cart_path, notice: Comable.t('carts.added') else flash.now[:alert] = Comable.t('carts.invalid') render :show end end |
#checkout ⇒ Object
36 37 38 39 |
# File 'app/controllers/comable/carts_controller.rb', line 36 def checkout current_order.next_state if current_order.state?(:cart) redirect_to comable.next_order_path(state: :confirm) end |
#destroy ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/comable/carts_controller.rb', line 24 def destroy cart_item = find_cart_item return redirect_by_product_not_found unless cart_item if current_comable_user.reset_cart_item(cart_item) redirect_to comable.cart_path, notice: Comable.t('carts.updated') else flash.now[:alert] = Comable.t('carts.invalid') render :show end end |
#update ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'app/controllers/comable/carts_controller.rb', line 15 def update if current_comable_user.reset_cart_item(@cart_item, ) redirect_to comable.cart_path, notice: Comable.t('carts.updated') else flash.now[:alert] = Comable.t('carts.invalid') render :show end end |