Module: Effective::WizardController::Actions

Included in:
Effective::WizardController
Defined in:
app/controllers/concerns/effective/wizard_controller/actions.rb

Instance Method Summary collapse

Instance Method Details

#newObject



5
6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/concerns/effective/wizard_controller/actions.rb', line 5

def new
  Rails.logger.info 'Processed by Effective::WizardController#new'

  self.resource ||= (find_wizard_resource || resource_scope.new)
  EffectiveResources.authorize!(self, :new, resource)

  redirect_to resource_wizard_path(
    (resource.to_param || :new),
    (resource.first_uncompleted_step || resource_wizard_steps.first)
  )
end

#showObject



17
18
19
20
21
22
# File 'app/controllers/concerns/effective/wizard_controller/actions.rb', line 17

def show
  Rails.logger.info 'Processed by Effective::WizardController#show'

  run_callbacks(:resource_render)
  render_wizard
end

#updateObject



24
25
26
27
28
29
30
31
32
33
34
# File 'app/controllers/concerns/effective/wizard_controller/actions.rb', line 24

def update
  Rails.logger.info 'Processed by Effective::WizardController#update'

  action = (commit_action[:action] == :save ? :update : commit_action[:action])
  EffectiveResources.authorize!(self, action, resource)

  resource.assign_attributes(send(resource_params_method_name))
  assign_current_step

  save_wizard_resource(resource, action)
end