Add API for updating and deactivating users

This commit is contained in:
Stanko K.R.
2025-12-09 12:17:42 +01:00
parent 7a0554774c
commit ba30a301dc
2 changed files with 28 additions and 2 deletions
+9 -2
View File
@@ -14,7 +14,10 @@ class UsersController < ApplicationController
def update
if @user.update(user_params)
redirect_to @user
respond_to do |format|
format.html { redirect_to @user }
format.json { head :no_content }
end
else
render :edit, status: :unprocessable_entity
end
@@ -22,7 +25,11 @@ class UsersController < ApplicationController
def destroy
@user.deactivate
redirect_to users_path
respond_to do |format|
format.html { redirect_to users_path }
format.json { head :no_content }
end
end
private