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
7 8 9 10 11 12 13 14 |
# File 'app/controllers/comable/carts_controller.rb', line 7 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
34 35 36 37 |
# File 'app/controllers/comable/carts_controller.rb', line 34 def checkout current_order.next_state if current_order.state?(:cart) redirect_to comable.next_order_path(state: :confirm) end |
#destroy ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'app/controllers/comable/carts_controller.rb', line 25 def destroy 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
16 17 18 19 20 21 22 23 |
# File 'app/controllers/comable/carts_controller.rb', line 16 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 |