Admin able to delete users except admins

This commit is contained in:
Gopesh Tulsyan 2014-03-27 20:14:52 +05:30
parent 628211f0fc
commit 481fcc9f60
2 changed files with 19 additions and 0 deletions

View file

@ -15,5 +15,17 @@ class Admin::UsersController < ApplicationController
user = User.find(params[:id])
user.update_attributes!(params[:user])
redirect_to admin_users_path, :notice => "Updated #{user.email}"
end
def delete
@user = User.find(params[:id])
end
def destroy
@user = User.find(params[:id])
@user.destroy
redirect_to admin_users_path, :notice => "User got deleted"
end
end