Skip to content

Commit 1562c19

Browse files
cjcolvarmasaball
andcommitted
Reinitialize context and rerun custom_edit when rendering edit view due to failed update
Co-authored-by: Mason Ballengee <[email protected]>
1 parent 1c188a2 commit 1562c19

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: lib/avalon/workflow/workflow_controller_behavior.rb

+5
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ 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 = perform_step_action :before_step
76+
custom_edit #yield to custom_edit in the controller
77+
7378
render :edit
7479
elsif model_object.workflow.published? && model_object.workflow.current?(@active_step)
7580
redirect_to(polymorphic_path(model_object), flash: flashes)

0 commit comments

Comments
 (0)