1 parent
372e86507e
commit
2233d73c39
9 files changed
+54
-2
No files matched your search
@@ -2,6 +2,8 @@
|
||||
class Quiz < ApplicationRecord
|
||||
has_many :questions, -> { order(:sort) }
|
||||
has_many :candidates
|
||||
has_many :reviewer_to_quizzes
|
||||
has_many :reviewers, through: :reviewer_to_quizzes, source: :user
|
||||
|
||||
validates :name, presence: true, uniqueness: true
|
||||
validates :dept, presence: true
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
class ReviewerToQuiz < ApplicationRecord
|
||||
belongs_to :user
|
||||
belongs_to :quiz
|
||||
end
|
||||
+3
-1
@@ -1,7 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
class User < ApplicationRecord
|
||||
has_secure_password
|
||||
has_many :candidates, foreign_key: "recruiter_id"
|
||||
has_many :candidates, foreign_key: :recruiter_id
|
||||
has_many :reviewer_to_quizzes
|
||||
has_many :quizzes, through: :reviewer_to_quizzes
|
||||
|
||||
validates :email, presence: true, uniqueness: true
|
||||
validates :name, presence: true
|
||||
|
||||
Reference in new issue
Block a user