Commit 19e8473e authored by Marin Jankovski's avatar Marin Jankovski Committed by Sytse Sijbrandij

Cannot remove user that owns a project.

Cannot remove user that owns a project.

Make lines shorter, set alert, use path instead of url.
parent 2ff36e74
......@@ -98,6 +98,9 @@ class Admin::UsersController < AdminController
def destroy
@admin_user = User.find(params[:id])
if @admin_user.my_own_projects.count > 0
redirect_to admin_users_path, alert: "User is a project owner and can't be removed." and return
end
@admin_user.destroy
respond_to do |format|
......
Markdown is supported
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