Merge pull request #1906 from dosire/user_cannot_be_removed_if_project_owner

Cannot remove user that owns a project.
This commit is contained in:
Dmitriy Zaporozhets 2012-11-19 04:12:31 -08:00
commit 4eef112462

View file

@ -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|