Class: Gendalf::WizardController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
lib/controllers/wizard_controller.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.model_nameObject



34
35
36
# File 'lib/controllers/wizard_controller.rb', line 34

def model_name
  @@model_name
end

.set_model_name(model_name) ⇒ Object



30
31
32
# File 'lib/controllers/wizard_controller.rb', line 30

def set_model_name(model_name)
  @@model_name = model_name
end

Instance Method Details

#defaultObject



39
40
41
# File 'lib/controllers/wizard_controller.rb', line 39

def default
  redirect_to custom_wizard_path(current_step)
end

#modelObject



8
9
10
# File 'lib/controllers/wizard_controller.rb', line 8

def model
  @@model_name.to_s.camelize.constantize.steps[step_no]
end

#stepObject



12
13
14
15
16
# File 'lib/controllers/wizard_controller.rb', line 12

def step
  load_current_step
  send step_action_name
  render :action => step_action_name
end

#step_submitObject



18
19
20
21
22
23
24
25
26
27
# File 'lib/controllers/wizard_controller.rb', line 18

def step_submit
  if proceed_custom_or_default_step_submit
    if respond_to?(step_action_name(step_no+1))
      self.current_step = step_no+1
      redirect_to wizard_path(self.current_step)
    end
  else
    render :action => step_action_name
  end
end