Skip to content

Commit

Permalink
feature: Allow custom destroy methods. (#1818)
Browse files Browse the repository at this point in the history
  • Loading branch information
davekruse authored Jul 4, 2023
1 parent 3bef387 commit 84c5f11
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions app/controllers/avo/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 84c5f11

Please sign in to comment.