web/mooctracker_rails/app/controllers/studentcourses_controller.rb
def index
    if current_user.admin?
      @studentcourses = Studentcourse.all
      render json: @studentcourses
    else
      @studentcourses= Studentcourse.where("user_id = ?", current_user)
      render json: @studentcourses
    end
  end
#On GET request to /studentcourses/ it returns all student courses.
On GET request to /studentcourses/ it returns all student courses.
On GET request to / studentcourses / it returns all student courses .
def index
    if current_user.admin?
      @studentcourses = Studentcourse.all
      render json: @studentcourses
    else
      @studentcourses= Studentcourse.where("user_id = ?", current_user)
      render json: @studentcourses
    end
  end
def index if current_user . admin? @studentcourses = Studentcourse . all render json : @studentcourses else @studentcourses = Studentcourse . where ( "user_id = ?" , current_user ) render json : @studentcourses end end
On GET request to /studentcourses/ it returns all student courses.
On GET request to / studentcourses / it returns all student courses .