Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Suicide is immoral

  • Loading branch information...
commit cea4e769cc29473008bd501ed0056144ca5c203f 1 parent 2b33132
@dirksiemers authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 app/controllers/users_controller.rb
View
9 app/controllers/users_controller.rb
@@ -40,8 +40,13 @@ def update
end
def destroy
- User.find(params[:id]).destroy
- flash[:success] = "User destroyed."
+ user = User.find(params[:id])
+ if current_user?(user)
+ user.destroy
+ flash[:success] = "User destroyed."
+ else
+ flash[:notice] = "Cannot destroyed yourself."
+ end
redirect_to users_path
end
Please sign in to comment.
Something went wrong with that request. Please try again.