Permalink
Browse files

Cannot remove user that owns a project.

Cannot remove user that owns a project.

Make lines shorter, set alert, use path instead of url.
  • Loading branch information...
1 parent 2ff36e7 commit 19e8473eb7dd456b64315b1b9e62c780ace98fef @maxlazio maxlazio committed with dosire Nov 2, 2012
Showing with 3 additions and 0 deletions.
  1. +3 −0 app/controllers/admin/users_controller.rb
View
3 app/controllers/admin/users_controller.rb
@@ -98,6 +98,9 @@ def update
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|

0 comments on commit 19e8473

Please sign in to comment.