# frozen_string_literal: true
#= Controller for course functionality
class ExploreController < ApplicationController
  respond_to :html

  def index
    campaign = params[:campaign] || ENV['default_campaign']
    @presenter = CoursesPresenter.new(current_user, campaign)
    raise ActionController::RoutingError
      .new('Not Found'), 'Campaign does not exist' unless @presenter.campaign
  end
end

# frozen_string_literal: true
#= Controller for course functionality
class ExploreController < ApplicationController
  respond_to :html

  def index
    # 'cohort' is the old name for campaign. We accept 'cohort' as an alternative
    # parameter to keep old incoming links from breaking.
    campaign = params[:campaign] || params[:cohort] || ENV['default_campaign']
    @presenter = CoursesPresenter.new(current_user, campaign)
    return unless @presenter.campaign.nil?
    raise ActionController::RoutingError.new('Not Found'), 'Campaign does not exist'
  end
end

Fix links that use old 'cohort' parameter
Fix links that use old 'cohort' parameter
