Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
aoz-003
Commits
732eb328
Commit
732eb328
authored
May 10, 2017
by
Tugce Nur Tas
Committed by
Tuğçe Nur Taş
May 12, 2017
Browse files
complete adding destroy method
parent
e2db15f2
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/controllers/users_controller.rb
View file @
732eb328
class
UsersController
<
ApplicationController
before_action
:set_user
,
only:
[
:show
,
:edit
,
:update
]
before_action
:set_user
,
only:
[
:show
,
:edit
,
:update
,
:destroy
]
after_action
:verify_authorized
def
index
...
...
app/policies/user_policy.rb
View file @
732eb328
...
...
@@ -31,6 +31,6 @@ class UserPolicy < ApplicationPolicy
end
def
destroy?
@current_user
.
admin_or_superadmin?
@current_user
.
admin_or_superadmin?
&&
@current_user
!=
@user
end
end
config/routes.rb
View file @
732eb328
Rails
.
application
.
routes
.
draw
do
devise_for
:users
resources
:users
,
except: :destroy
resources
:users
resources
:clients
resources
:profiles
,
except:
[
:destroy
,
:index
]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment