From 84c5f1107351bfcb01ae8ed82823fdb23591381d Mon Sep 17 00:00:00 2001 From: Dave Kruse <35437+davekruse@users.noreply.github.com> Date: Tue, 4 Jul 2023 13:40:03 -0500 Subject: [PATCH] feature: Allow custom destroy methods. (#1818) --- app/controllers/avo/base_controller.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/controllers/avo/base_controller.rb b/app/controllers/avo/base_controller.rb index f27488da21..50486b1c88 100644 --- a/app/controllers/avo/base_controller.rb +++ b/app/controllers/avo/base_controller.rb @@ -215,16 +215,24 @@ def order def save_model perform_action_and_record_errors do - @model.save! + save_model_action end end + def save_model_action + @model.save! + end + def destroy_model perform_action_and_record_errors do - @model.destroy! + destroy_model_action end end + def destroy_model_action + @model.destroy! + end + def perform_action_and_record_errors(&block) begin succeeded = block.call