module Sis module Core class Student < ApplicationRecord has_one_attached :picture belongs_to :user belongs_to :level, optional: true belongs_to :semester, optional: true belongs_to :entry, optional: true belongs_to :programme belongs_to :programme_level belongs_to :programme_type belongs_to :advisor, class_name: 'Sis::Core::Instructor', optional: true has_many :course_registrations delegate(:first_name, to: :user, prefix: false) delegate(:last_name, to: :user, prefix: false) delegate(:email, to: :user, prefix: false) delegate(:first_name, to: :advisor, prefix: true, allow_nil: true) delegate(:middle_name, to: :advisor, prefix: true, allow_nil: true) delegate(:last_name, to: :advisor, prefix: true, allow_nil: true) end end end