app/controllers/members_controller.rb
#Destroy user lecturer association and create tutor assiociation
Destroy user lecturer association and create tutor assiociation
Destroy user lecturer association and create tutor assiociation
def tutor
		if course_convenor?(@current_user, @course)
			@user = Lecturer.find_by(params[:lecturer_id]).user_id
			@lecturer = Lecturer.find_by(params[:lecturer_id])
			@lecturer.destroy
			Tutor.create!(user_id: @user, course_id: @course.id)
			flash[:success] = "Changed course member to tutor role"
			redirect_to course_members_path(@course)
		end
	end
def tutor if course_convenor? ( @current_user , @course ) @user = Lecturer . find_by ( params [ :lecturer_id ] ) . user_id @lecturer = Lecturer . find_by ( params [ :lecturer_id ] ) @lecturer . destroy Tutor . create! ( user_id : @user , course_id : @course . id ) flash [ :success ] = "Changed course member to tutor role" redirect_to course_members_path ( @course ) end end
Destroy user lecturer association and create tutor assiociation
Destroy user lecturer association and create tutor assiociation