Class: Journea::StepsController

Inherits:
EngineController show all
Defined in:
app/controllers/journea/steps_controller.rb

Instance Method Summary collapse

Instance Method Details

#editObject



6
7
8
9
10
# File 'app/controllers/journea/steps_controller.rb', line 6

def edit
  @step = current_step_class.new(@journea.data_for_form(current_step_class.new))
  @step.journey = @journea
  render template: @step.step_name
end

#updateObject



12
13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/journea/steps_controller.rb', line 12

def update
  @step = current_step_class.new(form_params)
  @step.pre_save(form_params)
  @step.journey = @journea
  if @journea.save_data(@step)
    @journea.transition_to_next_step
    redirect_to edit_journey_step_path(@journea, @journea.state_machine.current_state)
  else
    render template: @step.step_name
  end
end