hps_member/app/models/hps_counseling_record.rb

46 lines
1.1 KiB
Ruby

class HpsCounselingRecord
include Mongoid::Document
include Mongoid::Timestamps
field :hps_city_id
field :hps_county_id
field :hps_school_id
field :other_text
field :counseling_date, type: DateTime
field :counseling_method, type: Array, default: []
field :counseling_method_description
field :event_title
field :purpose_for_county, type: Array, default: []
field :purpose_for_county_extra
field :purpose_for_school, type: Array, default: []
field :purpose_for_school_extra
field :minutes_of_event
field :evaluation_of_event
belongs_to :hps_member
def get_title
city = HpsCity.find(self.hps_city_id) rescue nil
county = HpsCounty.find(self.hps_county_id) rescue nil
school = HpsSchool.find(self.hps_school_id) rescue nil
s = ""
s = s + city.name + "/" if !city.nil?
s = s + county.name + "/" if !county.nil?
s = s + school.name if !school.nil?
s
end
def get_city
HpsCity.find(self.hps_city_id) rescue nil
end
def get_county
HpsCounty.find(self.hps_county_id) rescue nil
end
def get_school
HpsSchool.find(self.hps_school_id) rescue nil
end
end