app/models/notification.rb
# returns the lecture associated to a notification of type announcement,
# and teachable for a notification of type medium, nil otherwise
returns the lecture associated to a notification of type announcement,
and teachable for a notification of type medium, nil otherwise
returns the lecture associated to a notification of type announcement and teachable for a notification of type medium nil otherwise
def teachable
    return unless notifiable.present?
    return if notifiable_type.in?(['Lecture', 'Course'])
    return notifiable.lecture if notifiable_type == 'Announcement'
    notifiable.teachable
  end
def teachable return unless notifiable . present? return if notifiable_type . in? ( [ 'Lecture' , 'Course' ] ) return notifiable . lecture if notifiable_type == 'Announcement' notifiable . teachable end
returns the lecture associated to a notification of type announcement,
and teachable for a notification of type medium, nil otherwise
returns the lecture associated to a notification of type announcement and teachable for a notification of type medium nil otherwise
# notifiable will be a medium, so return its teachable