diff --git a/app/controllers/admin/budgets_controller.rb b/app/controllers/admin/budgets_controller.rb index 7caf4f35c..2d6fc7d8f 100644 --- a/app/controllers/admin/budgets_controller.rb +++ b/app/controllers/admin/budgets_controller.rb @@ -42,6 +42,15 @@ class Admin::BudgetsController < Admin::BaseController end end + def destroy + if @budget.investments.any? + redirect_to admin_budgets_path, alert: t('admin.budgets.destroy.unable_notice') + else + @budget.destroy + redirect_to admin_budgets_path, notice: t('admin.budgets.destroy.success_notice') + end + end + private def budget_params