Add destroy action to admin budget controller
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user