recruitment/app/models/employee_profile.rb

60 lines
1.6 KiB
Ruby

class EmployeeProfile
include Mongoid::Document
include Mongoid::Timestamps
# personal info
mount_uploader :avatar, ImageUploader
field :gender #type1 -> male, type2 -> female, type3 -> other
field :dob, type: DateTime
field :marital_status #type1 -> unmarried, type2 -> married
field :phone_number
field :country_code
field :website
field :address, localize: true
field :autobiography, localize: true
field :employment_status #type1 -> employed, type2 -> unemployed
field :active, type: Boolean, :default => true
# job info
field :desired_job_title, localize: true
field :current_company, localize: true
field :resume_content, localize: true
field :desired_place
field :working_time #type1 -> day shift type2 -> night shift
field :skills, type: Array, :default => []
field :languages
field :experience_years, type: Integer, :default => 0
field :experience_months, type: Integer, :default => 0
field :introduction, localize: true
field :recommendation_tokens, type: Array, :default => []
mount_uploader :resume, AssetUploader
belongs_to :recruit_profile
has_many :employee_academics
has_many :employee_experiences
has_many :employee_job_applications
has_many :employee_recommendations
scope :job_seekers, ->{where(:active => true)}
def is_job_applied?(jobid)
self.employee_job_applications.where(:job => jobid).count > 0
end
def get_avatar
if self.avatar.url.nil?
return "/assets/person.png"
else
return self.avatar.url
end
end
def get_current_exp
self.employee_experiences.where(:end_date => nil).first rescue nil
end
end