This is a generated Rails "model" file (of 96 such files generated for this application)

All foreign-key relationships have Rails associations generated for both ends (co-referenced) with consistent naming for ease of use. # Auto-generated from CQL, edits will be lost module Relations   module Candidate extend ActiveSupport::Concern included do self.primary_key = 'person_id' # Candidate has Candidate Status belongs_to :candidate_status # Work Experience (in which Candidate participated in work experience) and Work Experience was with Company belongs_to :company_via_work_experience, :class_name => 'Company', :foreign_key => :work_experience_company_id # Candidate was born in birth-Country belongs_to :birth_country, :class_name => 'Country', :foreign_key => :birth_country_id # Candidate has primary- citizenship Country belongs_to :primary_citizenship_country, :class_name => 'Country', :foreign_key => :primary_citizenship_country_id # Candidate has resume-Document belongs_to :resume_document, :class_name => 'Document', :foreign_key => :resume_document_id # JSA Registration (in which Candidate is registered with JSA) and JSA Registration is through JSA Office belongs_to :jsa_office_via_jsa_registration, :class_name => 'JSAOffice', :foreign_key => :jsa_registration_jsa_office_id # Work Experience (in which Candidate participated in work experience) and Work Experience has contact-Person belongs_to :contact_person_via_work_experience, :class_name => 'Person', :foreign_key => :work_experience_contact_person_id # Candidate is a kind of Person belongs_to :person # School Attendance (in which Candidate is attending secondary school) and School Attendance is in Suburb belongs_to :suburb_via_school_attendance, :class_name => 'Suburb', :foreign_key => :school_attendance_suburb_id # Candidate has preferred-Trade belongs_to :preferred_trade, :class_name => 'Trade', :foreign_key => :preferred_trade_id # Apprenticeship Interest (in which Candidate is interested in Apprenticeship Type) has_many :apprenticeship_interests, :class_name => 'ApprenticeshipInterest', :foreign_key => :candidate_id, :dependent => :destroy has_many :apprenticeship_types, :through => :apprenticeship_interests # Aptitude Testing (in which Candidate participates in Aptitude Test) has_many :aptitude_testings, :class_name => 'AptitudeTesting', :foreign_key => :candidate_id, :dependent => :destroy # Candidate Referral (in which Candidate received Referral) has_many :candidate_referrals, :class_name => 'CandidateReferral', :foreign_key => :candidate_id, :dependent => :destroy has_many :referrals, :through => :candidate_referrals # File Note applies to PreApprenticeship and Candidate undertook PreApprenticeship has_many :file_notes_via_pre_apprenticeship, :class_name => 'FileNote', :foreign_key => :pre_apprenticeship_id, :dependent => :destroy # File Note applies to School Achievement and Candidate has School Achievement has_many :file_notes_via_school_achievement, :class_name => 'FileNote', :foreign_key => :school_achievement_id, :dependent => :destroy # Interview (in which Candidate participated in interview with Employer on DateMaybeTime) has_many :interviews, :class_name => 'Interview', :foreign_key => :candidate_id, :dependent => :destroy # Language Spoken (in which Candidate speaks Language) has_many :language_spokens, :class_name => 'LanguageSpoken', :foreign_key => :candidate_id, :dependent => :destroy has_many :languages, :through => :language_spokens # Personal Characterisation (in which Candidate has Personal Characteristic) has_many :personal_characterisations, :class_name => 'PersonalCharacterisation', :foreign_key => :candidate_id, :dependent => :destroy has_many :personal_characteristics, :through => :personal_characterisations # Candidate has Personal Reference has_many :personal_references, :class_name => 'PersonalReference', :foreign_key => :candidate_id, :dependent => :destroy # Previous Employment (in which Candidate was employed with Previous Employer) has_many :previous_employments, :class_name => 'PreviousEmployment', :foreign_key => :candidate_id, :dependent => :destroy # Skills Certificate (in which Candidate has Skills Certification) has_many :skills_certificates, :class_name => 'SkillsCertificate', :foreign_key => :candidate_id, :dependent => :destroy has_many :skills_certifications, :through => :skills_certificates # Task has Task Subject and Task Subject is played by Candidate has_many :tasks_via_task_subject, :class_name => 'Task', :foreign_key => :task_subject_candidate_id, :dependent => :destroy # Work Travel Method (in which Candidate commutes by Travel Method) has_many :work_travel_methods, :class_name => 'WorkTravelMethod', :foreign_key => :candidate_id, :dependent => :destroy has_many :travel_methods, :through => :work_travel_methods validates :person_id, :presence => true end end end