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