app/controllers/supervisors_controller.rb
def update
    @supervisor = Supervisor.find(params[:id])

    if can_update_fields?
      if @supervisor.update(update_supervisor_params)
        redirect_to edit_supervisor_path(@supervisor), notice: "Supervisor was successfully updated."
      else
        render :edit
      end
    else
      redirect_to root_url
    end
  end
# Uses authenticate_user to redirect if no user is signed in
# and must_be_admin_or_supervisor to check user's role is appropriate
Uses authenticate_user to redirect if no user is signed in
and must_be_admin_or_supervisor to check user's role is appropriate
Uses authenticate_user to redirect if no user is signed in and must_be_admin_or_supervisor to check user ' s role is appropriate
def update
    @supervisor = Supervisor.find(params[:id])
    if can_update_fields?
      if @supervisor.update(update_supervisor_params)
        redirect_to edit_supervisor_path(@supervisor), notice: "Supervisor was successfully updated."
      else
        render :edit
      end
    else
      redirect_to root_url
    end
  end
def update @supervisor = Supervisor . find ( params [ :id ] ) if can_update_fields? if @supervisor . update ( update_supervisor_params ) redirect_to edit_supervisor_path ( @supervisor ) , notice : "Supervisor was successfully updated." else render :edit end else redirect_to root_url end end
Uses authenticate_user to redirect if no user is signed in
and must_be_admin_or_supervisor to check user's role is appropriate
Uses authenticate_user to redirect if no user is signed in and must_be_admin_or_supervisor to check user ' s role is appropriate