schedules_controller.rb 397 Bytes
Newer Older
1
2
3
4
5
require 'icalendar'
require 'time'

# Contains functionality for generating schedules.
class SchedulesController < ApplicationController
Zac Wood's avatar
Zac Wood committed
6
  # Render an iCal file containing the schedules of all the
7
8
9
10
11
12
13
  # course sections with the given CRNs.
  def index
    crns = params["crns"].split ','
    @schedule = Schedule.new crns
    render plain: @schedule.to_ical # render a plaintext iCal file
  end
end