From 8b1e11a314b62a79667e9c4c402dcce78e453314 Mon Sep 17 00:00:00 2001 From: aignatov-bio Date: Thu, 3 Sep 2020 14:19:28 +0200 Subject: [PATCH] Add conditions_fulfilled? method --- app/models/my_module_status.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/models/my_module_status.rb b/app/models/my_module_status.rb index 101606c40..c35506760 100644 --- a/app/models/my_module_status.rb +++ b/app/models/my_module_status.rb @@ -47,6 +47,14 @@ class MyModuleStatus < ApplicationRecord ordered_statuses end + def conditions_fulfilled?(my_module) + my_module_status_conditions.each do |condition| + condition.call(my_module) + end + + my_module.errors.blank? + end + private def next_in_same_flow