From 4f784b28d222d544ef6a3dbc4c55e127b61bcfd0 Mon Sep 17 00:00:00 2001 From: katushe Date: Sat, 14 May 2016 16:13:56 -0500 Subject: [PATCH] Add availabilities/subjects/grade levels to mentor show page --- mentors4all/app/controllers/mentors_controller.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mentors4all/app/controllers/mentors_controller.rb b/mentors4all/app/controllers/mentors_controller.rb index c17a0d6..cfff09f 100644 --- a/mentors4all/app/controllers/mentors_controller.rb +++ b/mentors4all/app/controllers/mentors_controller.rb @@ -16,7 +16,19 @@ def create end def show + @mentor = Mentor.find(params[:id]) + render json: {mentor: @mentor, availabilities: @mentor.availabilities, grade_levels: @mentor.grade_levels, subjects: @mentor.cs_subjects} + end + + def update + @mentor = Mentor.find(params[:id]) + @mentor.update_attributes(mentor_params) + render json: {mentor: @mentor} end + private + def mentor_params + params.require(:mentor).permit(:location, :employment_status, :employment_location, :prior_experience, :courses_taken, :interest_in_mentoring, :example_explanation, :cs_expertise) + end end