From cbe707b33e87418b8576cbc3fbd23bcd032153cb Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Wed, 6 Dec 2017 17:00:35 +0000 Subject: [PATCH] Validate the assigned role, and remove the :type activrecord enum --- app/models/issue.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/issue.rb b/app/models/issue.rb index 7294b07f5..1fe078ad9 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -37,13 +37,13 @@ class Issue < ActiveRecord::Base validates :reportable_id, :uniqueness => { :scope => [:reportable_type] } validates :reported_user_id, :presence => true + validates :assigned_role, :presence => true, :inclusion => %w[administrator moderator] before_validation :set_default_assigned_role before_validation :set_reported_user # Check if more statuses are needed enum :status => %w[open ignored resolved] - enum :type => %w[administrator moderator] scope :with_status, ->(issue_status) { where(:status => statuses[issue_status]) } -- 2.39.5