recruitment/app/models/employee_profile.rb

60 lines
1.6 KiB
Ruby
Raw Normal View History

2017-12-21 19:41:50 +00:00
class EmployeeProfile
include Mongoid::Document
include Mongoid::Timestamps
2018-01-01 13:52:15 +00:00
# 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 :recommendation1_info
field :recommendation2_info
field :experience_years, type: Integer, :default => 0
field :experience_months, type: Integer, :default => 0
field :introduction, localize: true
mount_uploader :resume, AssetUploader
2017-12-21 19:41:50 +00:00
belongs_to :recruit_profile
2018-01-01 13:52:15 +00:00
has_many :employee_academics
has_many :employee_experiences
has_many :employee_job_applications
scope :job_seekers, ->{where(:active => true)}
def is_job_applied?(jobid)
self.employee_job_applications.where(:job => jobid).count > 0
end
2018-01-01 13:52:15 +00:00
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
2017-12-21 19:41:50 +00:00
end