application_controller.rb 356 Bytes
Newer Older
1
# Configures the application.
Zac Wood's avatar
Zac Wood committed
2
class ApplicationController < ActionController::Base
Zac Wood's avatar
Zac Wood committed
3
  protect_from_forgery with: :null_session
4
5
6
7
8
9
10
  before_action :set_cookies, :set_cart

  def set_cart
    @cart = cookies[:ids].split(',').map do |crn|
      CourseSection.find_by_crn crn
    end
  end
Zac Wood's avatar
Zac Wood committed
11
12
13
14

  def set_cookies
    cookies[:ids] = "" if cookies[:ids].nil?
  end
Zac Wood's avatar
Zac Wood committed
15
end