# This is a Foreign Object Reference Table, keyed to the external data source by #recording_uuid class Recording < ApplicationRecord belongs_to :course def recording_url return nil if recording_uuid.nil? "https://uniofbath.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=#{recording_uuid}" end def nice_title if course.title == "General Relativity" regex = /.+L(\d+).*/ lecture_number = self.title.match(regex)[1].to_i return "Lecture #{lecture_number}" end title end end