From 19e8473eb7dd456b64315b1b9e62c780ace98fef Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Fri, 2 Nov 2012 12:26:41 +0100 Subject: Cannot remove user that owns a project. Cannot remove user that owns a project. Make lines shorter, set alert, use path instead of url. --- app/controllers/admin/users_controller.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'app') diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index c9586ad5da9..744b1912a6c 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -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| -- cgit v1.2.1