Commit 1dba6b23 authored by Zach Perkins's avatar Zach Perkins
Browse files

Create course listing controller

parent 512d3abf
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.
// Place all the styles related to the CourseListing controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
class CourseListingController < ApplicationController
api :GET, '/course_listing', "Get all available courses and their sections"
param :subject, String, desc:'Course subject, e.g. "CS" or "ACCT"'
param :number, Integer, desc: 'Course number, e.g. "112"'
def index
@courses = Course.find_by(params).joins('sections')
render json: @courses
end
end
require 'test_helper'
class CourseListingControllerTest < ActionDispatch::IntegrationTest
# test "the truth" do
# assert true
# end
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment