module Sis module Core class Staff < ApplicationRecord belongs_to :user, class_name: 'User' SINGLE = 'Single'.freeze MARRIED = 'Married'.freeze MARITAL_STATUS = [SINGLE, MARRIED].freeze validates :job_title, :job_level, :department, :date_of_employment, :salary, :remark, :mothers_name, :education_level, :phone_number, :place_of_birth, :marital_status, :region, :zone, :wereda, :kebele, :id_number, :emergency_contact_name, :emergency_contact_phone, :relation_to_emergency_contact, :user_id, presence: true validates :salary, numericality: true validates :marital_status, inclusion: { in: MARITAL_STATUS } validates :id_number, uniqueness: true validates :passport_number, uniqueness: true, if: :passport_number? end end end