candidate creation
This commit is contained in:
@ -4,11 +4,14 @@ class Candidate < ApplicationRecord
|
||||
has_many :answers
|
||||
belongs_to :recruiter, class_name: "User"
|
||||
|
||||
before_create :generate_test_hash
|
||||
before_validation(:generate_test_hash, on: :create)
|
||||
|
||||
validates_presence_of :name
|
||||
validates_presence_of :email
|
||||
validates_presence_of :experience
|
||||
validates_presence_of :recruiter_id
|
||||
validates_presence_of :test_hash
|
||||
validates_uniqueness_of :test_hash
|
||||
validates :email, uniqueness: true, presence: true, email_format: true
|
||||
validates :test_hash, uniqueness: true, presence: true
|
||||
|
||||
def submitted_answers
|
||||
answers.where(submitted: true)
|
||||
|
Reference in New Issue
Block a user