From: Andy Allan Date: Wed, 6 Dec 2017 17:00:35 +0000 (+0000) Subject: Validate the assigned role, and remove the :type activrecord enum X-Git-Tag: live~3501^2~72 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/cbe707b33e87418b8576cbc3fbd23bcd032153cb?ds=sidebyside Validate the assigned role, and remove the :type activrecord enum --- 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]) }