Allowing to delete users

This commit is contained in:
Linus Gasser 2025-10-13 08:20:59 +02:00
parent d8e68caa12
commit c5808a4fdc
3 changed files with 21 additions and 4 deletions

View file

@ -65,6 +65,14 @@ module Admin
def edit; end
def destroy
if @user.destroy
redirect_to admin_users_path, notice: "User #{@user.name} (#{@user.email}) was successfully deleted."
else
redirect_to admin_users_path, error: "Could not delete user #{@user.name} (#{@user.email}). #{@user.errors.full_messages.join('. ')}."
end
end
private
def user_params