user blocking

This commit is contained in:
Karol Selak 2021-03-21 23:43:09 +01:00
parent ccb6e23960
commit 2804c55fd9
9 changed files with 44 additions and 11 deletions

View file

@ -1,5 +1,5 @@
class UsersController < ApplicationController
before_action :ensure_admin, only: [:destroy]
before_action :ensure_admin, only: [:destroy, :block]
def index
@users = User.all
@ -56,4 +56,9 @@ class UsersController < ApplicationController
User.destroy(params[:id])
redirect_to '/users'
end
def block
User.find(params[:id]).update(status: :blocked)
redirect_to '/users'
end
end