From facce9d0bb04ebdaa185c65eb8772aa7ff4db01f Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Wed, 14 Mar 2018 17:35:58 +0800 Subject: [PATCH] Refactor set_default_assigned_role to be more easily read. --- app/models/issue.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/models/issue.rb b/app/models/issue.rb index 00ee934f7..c02254a1b 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -95,7 +95,11 @@ class Issue < ActiveRecord::Base end def set_default_assigned_role - role = %w[Note].include?(reportable.class.name) ? "moderator" : "administrator" - self.assigned_role = role if assigned_role.blank? + if assigned_role.blank? + self.assigned_role = case reportable + when Note then "moderator" + else "administrator" + end + end end end -- 2.43.2