class CoursesController < ApplicationController
  
  def index
    @courses = Course.all

    respond_to do |format|
      format.html 
      format.json {render json: @courses}
    end
  end
end
class CoursesController < ApplicationController
  def index
    track = Track.find(params[:track_id])
    render json: track.courses
  end


end

Make the index of courses render straight json
Make the index of courses render straight json