Skip to content

Commit 503f5fd

Browse files
authored
Merge pull request #11 from avalonmediasystem/failed_update_setup_edit
Reinitialize context and rerun custom_edit when rendering edit view due to failed update
2 parents 1c188a2 + df6cdec commit 503f5fd

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/avalon/workflow/workflow_controller_behavior.rb

+6
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ def update
7070
flashes = { error: context[:error], notice: context[:notice]}
7171
if model_object.errors.present?
7272
flash.now[:error] = 'There are errors with your submission. Please correct them before continuing.'
73+
74+
# Refresh the context before rendering edit
75+
context = HYDRANT_STEPS.get_step(@active_step).send(:before_step, context)
76+
context_to_instance_variables context
77+
custom_edit #yield to custom_edit in the controller
78+
7379
render :edit
7480
elsif model_object.workflow.published? && model_object.workflow.current?(@active_step)
7581
redirect_to(polymorphic_path(model_object), flash: flashes)

0 commit comments

Comments
 (0)