Module: Submission::Priorities

Included in:
Submission
Defined in:
app/models/submission/priorities.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object


12
13
14
15
16
17
# File 'app/models/submission/priorities.rb', line 12

def self.included(base)
  base.class_eval do
    validates_presence_of :priority
    validates_numericality_of :priority, only_integer: true, greater_than_or_equal_to: 0, less_than_or_equal_to: 3
  end
end

.optionsObject


6
7
8
9
10
# File 'app/models/submission/priorities.rb', line 6

def self.options
  (0...priorities.count).map do |i|
    ["#{priorities[i]} - #{i}", i]
  end
end

.prioritiesObject


2
3
4
# File 'app/models/submission/priorities.rb', line 2

def self.priorities
  %w(None Low Medium High)
end