db work
This commit is contained in:
18
app/models/reviewer_vote.rb
Normal file
18
app/models/reviewer_vote.rb
Normal file
@ -0,0 +1,18 @@
|
||||
# frozen_string_literal: true
|
||||
class ReviewerVote < ApplicationRecord
|
||||
# validates :user_id, uniqueness: {scope: :friend_id}
|
||||
|
||||
belongs_to :candidate
|
||||
belongs_to :user
|
||||
|
||||
enum vote: {
|
||||
undecided: 0,
|
||||
yea: 1,
|
||||
nay: 2
|
||||
}
|
||||
|
||||
enum veto: {
|
||||
approved: 1,
|
||||
rejected: 2
|
||||
}
|
||||
end
|
@ -4,6 +4,7 @@ class User < ApplicationRecord
|
||||
has_many :candidates, foreign_key: :recruiter_id
|
||||
has_many :reviewer_to_quizzes
|
||||
has_many :quizzes, through: :reviewer_to_quizzes
|
||||
has_many :votes, class_name: 'ReviewerVote'
|
||||
|
||||
validates :email, presence: true, uniqueness: true
|
||||
validates :name, presence: true
|
||||
|
Reference in New Issue
Block a user