Commit 5de61c75 authored by Zac Wood's avatar Zac Wood
Browse files

Added search controller

parent e76685c0
// 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 Search controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here:
class SearchController < ApplicationController
def index
crn = params[:crn]
@sections = Section.find_by_crn(crn)
render json: @sections
<p>Find me in app/views/search/index.html.erb</p>
......@@ -4,6 +4,8 @@ Rails.application.routes.draw do
resources :courses, only: [:index] do # GET /api/courses
resources :sections, only: [:index] # GET /api/courses/:course_id/sections
get 'search', controller: 'search', action: 'index'
get 'home/index'
require 'test_helper'
class SearchControllerTest < ActionDispatch::IntegrationTest
test "should get index" do
get search_index_url
assert_response :success
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