app/models/referral.rb
# a referral belongs to an item and a medium
a referral belongs to an item and a medium
a referral belongs to an item and a medium
def end_time_not_too_late
    return true if medium.nil? || !medium.video
    return true unless end_time.valid?
    return true if end_time.total_seconds <= medium.video_duration
    errors.add(:end_time, :too_late)
    false
  end
def end_time_not_too_late return true if medium . nil? || ! medium . video return true unless end_time . valid? return true if end_time . total_seconds <= medium . video_duration errors . add ( :end_time , :too_late ) false end
a referral belongs to an item and a medium
a referral belongs to an item and a medium