Class: Corzinus::CheckoutsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Corzinus::CheckoutsController
- Includes:
- AddressableAttrubutes, Rectify::ControllerHelpers, Wicked::Wizard
- Defined in:
- app/controllers/corzinus/checkouts_controller.rb
Instance Method Summary collapse
Methods included from AddressableAttrubutes
#address_by_params, #addresses_by_model, #addresses_by_params, #set_countries
Methods included from Flashable
Methods included from Controllable
#authenticate_corzinus_person!, #current_order, #current_person
Instance Method Details
#show ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/corzinus/checkouts_controller.rb', line 13 def show Checkout::AccessStep.call(current_order, step) do on(:allow) { render_wizard } on(:not_allow) do redirect_to checkout_path(previous_step), alert: t('corzinus.flash.failure.step') end on(:empty_cart) do redirect_to edit_cart_path, alert: t('corzinus.flash.failure.empty_cart') end end end |
#update ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/corzinus/checkouts_controller.rb', line 26 def update = { order: current_order, params: params, person: current_person } "Corzinus::Checkout::#{step.capitalize}Step".constantize.call() do on(:valid) { render_wizard current_order } on(:invalid) do |step_results| expose step_results if step_results render_wizard end end end |