recruitment/app/models/employee_profile.rb

60 lines
1.8 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 :experience_years, type: Integer, :default => 0
field :experience_months, type: Integer, :default => 0
field :introduction, localize: true
field :recommendation_tokens, type: Array, :default => []
2018-01-01 13:52:15 +00:00
mount_uploader :resume, AssetUploader
2017-12-21 19:41:50 +00:00
belongs_to :recruit_profile
2018-01-01 13:52:15 +00:00
2018-07-18 15:57:29 +00:00
has_many :employee_academics, :autosave => true, :dependent => :destroy
has_many :employee_experiences, :autosave => true, :dependent => :destroy
has_many :employee_job_applications, :autosave => true, :dependent => :destroy
has_many :employee_recommendations, :autosave => true, :dependent => :destroy
2018-01-01 13:52:15 +00:00
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