2016-09-08 10:25:33 -05:00
|
|
|
# frozen_string_literal: true
|
2016-07-26 17:00:00 -05:00
|
|
|
class Quiz < ApplicationRecord
|
2016-07-28 20:54:08 -05:00
|
|
|
has_many :questions, -> { order(:sort) }
|
2016-07-27 11:17:50 -05:00
|
|
|
has_many :candidates
|
2016-09-15 13:26:31 -05:00
|
|
|
has_many :reviewer_to_quizzes
|
|
|
|
has_many :reviewers, through: :reviewer_to_quizzes, source: :user
|
2016-08-18 15:35:17 -05:00
|
|
|
|
2016-08-25 19:10:58 -05:00
|
|
|
validates :name, presence: true, uniqueness: true
|
|
|
|
validates :dept, presence: true
|
|
|
|
validates :unit, presence: true
|
2016-07-26 17:00:00 -05:00
|
|
|
end
|