Support the ability for admins to delete users
This commit is contained in:
parent
331e0a1610
commit
332bf8f1df
3 changed files with 28 additions and 5 deletions
|
|
@ -66,10 +66,14 @@ module Admin
|
|||
|
||||
def edit; end
|
||||
|
||||
def delete
|
||||
@user.destroy!
|
||||
flash[:notice] = "User #{@user.id} (#{@user.emai}) successfully deleted."
|
||||
redirect_to admin_users_path
|
||||
def destroy
|
||||
if @user.destroy
|
||||
redirect_to admin_users_path,
|
||||
notice: "User #{@user.id} (#{@user.email}) deleted."
|
||||
else
|
||||
redirect_to admin_users_path,
|
||||
error: "User #{@user.id} (#{@user.emai}) could not be deleted. #{@user.full_messages.join(',')}"
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue