From 61f6a3705f52f5afd858724e757c1a74f848c282 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Mon, 9 Dec 2019 22:25:03 +0200 Subject: [PATCH] Fail Loudly --- app/controllers/admin/api_users_controller.rb | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/app/controllers/admin/api_users_controller.rb b/app/controllers/admin/api_users_controller.rb index 4b79ffdaa..cb2c6ff52 100644 --- a/app/controllers/admin/api_users_controller.rb +++ b/app/controllers/admin/api_users_controller.rb @@ -46,13 +46,8 @@ module Admin end def destroy - if @api_user.destroy - flash[:notice] = I18n.t('record_deleted') - redirect_to admin_registrar_path(@api_user.registrar) - else - flash.now[:alert] = I18n.t('failed_to_delete_record') - render 'show' - end + @api_user.destroy! + redirect_to admin_registrar_path(@api_user.registrar), notice: t('record_deleted') end private