Commit 732eb328 authored by Tugce Nur Tas's avatar Tugce Nur Tas Committed by Tuğçe Nur Taş
Browse files

complete adding destroy method

parent e2db15f2
class UsersController < ApplicationController class UsersController < ApplicationController
before_action :set_user, only: [:show, :edit, :update] before_action :set_user, only: [:show, :edit, :update, :destroy]
after_action :verify_authorized after_action :verify_authorized
def index def index
......
...@@ -31,6 +31,6 @@ class UserPolicy < ApplicationPolicy ...@@ -31,6 +31,6 @@ class UserPolicy < ApplicationPolicy
end end
def destroy? def destroy?
@current_user.admin_or_superadmin? @current_user.admin_or_superadmin? && @current_user != @user
end end
end end
Rails.application.routes.draw do Rails.application.routes.draw do
devise_for :users devise_for :users
resources :users, except: :destroy resources :users
resources :clients resources :clients
resources :profiles, except: [:destroy, :index] resources :profiles, except: [:destroy, :index]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment