Add destroy action to admin budget controller

This commit is contained in:
Bertocq
2018-01-08 17:49:29 +01:00
parent dd3a0add2a
commit 799b96cc40

View File

@@ -42,6 +42,15 @@ class Admin::BudgetsController < Admin::BaseController
end end
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 private
def budget_params def budget_params