Module: Submission::Priorities

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

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



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

def self.included(base)
  base.class_eval do
    validates :priority, presence: true
    validates :priority, numericality: { only_integer: true, greater_than_or_equal_to: 0, less_than_or_equal_to: 3 }
  end
end

.optionsObject



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

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

.prioritiesObject



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

def self.priorities
  %w[None Low Medium High]
end