From b51b6fdebdf285a8bf65a72ff5a03d752398b3ad Mon Sep 17 00:00:00 2001 From: Karel Picman Date: Fri, 17 Mar 2017 13:50:09 +0100 Subject: [PATCH] APW unit tests --- app/controllers/dmsf_workflows_controller.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/controllers/dmsf_workflows_controller.rb b/app/controllers/dmsf_workflows_controller.rb index 6d470b74..dd79e993 100644 --- a/app/controllers/dmsf_workflows_controller.rb +++ b/app/controllers/dmsf_workflows_controller.rb @@ -413,12 +413,14 @@ class DmsfWorkflowsController < ApplicationController end end # Operators - params[:operator_step].each do |id, operator| - step = DmsfWorkflowStep.find_by_id id - if step - step.operator = operator.to_i - unless step.save - flash[:error] = step.errors.full_messages.to_sentence + if params[:operator_step].present? + params[:operator_step].each do |id, operator| + step = DmsfWorkflowStep.find_by_id id + if step + step.operator = operator.to_i + unless step.save + flash[:error] = step.errors.full_messages.to_sentence + end end end end