Class: Stall::Checkout::StepsController

Inherits:
ApplicationController show all
Includes:
Stall::CheckoutHelper
Defined in:
app/controllers/stall/checkout/steps_controller.rb

Instance Method Summary collapse

Methods included from Stall::CheckoutHelper

#available_shipping_methods_for, #step_path

Instance Method Details

#changeObject



28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/controllers/stall/checkout/steps_controller.rb', line 28

def change
  target_step = params[:step]

  if @wizard.step_complete?(target_step)
    @wizard.move_to_step!(target_step)
    redirect_to step_path
  else
    @step.prepare
    flash[:error] ||= t("stall.checkout.#{ target_step }.error")
    render 'show'
  end
end

#showObject



11
12
13
# File 'app/controllers/stall/checkout/steps_controller.rb', line 11

def show
  @step.prepare
end

#updateObject Also known as: foreign_update



15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/stall/checkout/steps_controller.rb', line 15

def update
  if @step.process
    @wizard.validate_current_step!
    redirect_to step_path
  else
    @step.prepare
    flash[:error] ||= t("stall.checkout.#{ @wizard.current_step_name }.error")
    render 'show'
  end
end