app/helpers/referrals_helper.rb
# returns the referrable's medium's/item's teachable scope (if present)
# in the form required by the teachable selector in the referral form,
# e.g. as 'Lecture-42', 'Course-5' etc.
returns the referrable's medium's/item's teachable scope (if present)
in the form required by the teachable selector in the referral form,
e.g.
returns the referrable ' s medium ' s / item ' s teachable scope ( if present ) in the form required by the teachable selector in the referral form e . g .
def teachable_selector(referral)
    return '' unless referral.medium.present?
    unless referral.item.present?
      return referral.medium.teachable&.media_scope&.selector_value
    end
    return 'external-0' if referral.item.sort == 'link'
    referral.item.medium.teachable&.media_scope&.selector_value
  end
def teachable_selector ( referral ) return '' unless referral . medium . present? unless referral . item . present? return referral . medium . teachable &. media_scope &. selector_value end return 'external-0' if referral . item . sort == 'link' referral . item . medium . teachable &. media_scope &. selector_value end
returns the referrable's medium's/item's teachable scope (if present)
in the form required by the teachable selector in the referral form,
e.g.
returns the referrable ' s medium ' s / item ' s teachable scope ( if present ) in the form required by the teachable selector in the referral form e . g .
referral
<not_specific>