module Sis module Core class ClassSchedule < ApplicationRecord belongs_to :classroom, optional: true belongs_to :class_time_table, optional: true belongs_to :course_assignment delegate(:room_number, to: :classroom, prefix: true, allow_nil: true) delegate(:name, to: :class_time_table, prefix: true, allow_nil: true) delegate(:course_code, to: :course_assignment, prefix: false) delegate(:course_title, to: :course_assignment, prefix: false) def instructor_full_name course_assignment.instructor.full_name end end end end