search_controller.rb 651 Bytes
Newer Older
Zac Wood's avatar
Zac Wood committed
1
2
class SearchController < ApplicationController
  def index
3
4
5
    @courses = Course.where(subject: 'GEOL').select do |course|
      course.course_sections.count > 0
    end
Zac Wood's avatar
Zac Wood committed
6
7
8
9
10
11
    
    @cart = cookies[:ids].split(',').map do |id|
      CourseSection.find_by_id id
    end
  end

12
13
14
  def update
    puts params[:ids]
    cookies[:ids] = params[:ids]
Zac Wood's avatar
Zac Wood committed
15
  end
16
17
18
19
20
21
22
  
  # def add
  #   ids = cookies[:ids].split(',').to_set
  #   ids.add(params[:id])
    
  #   cookies[:ids] = ids.to_a.join(',')
  # end
Zac Wood's avatar
Zac Wood committed
23

24
25
26
  # def remove
  #   ids = cookies[:ids].split(',').to_set
  #   ids.delete(params[:id])
Zac Wood's avatar
Zac Wood committed
27

28
  #   puts ids
Zac Wood's avatar
Zac Wood committed
29
    
30
31
  #   cookies[:ids] = ids.to_a.join(',')
  # end
Zac Wood's avatar
Zac Wood committed
32
end