Use find instead of find_by_id

Better raise a 404 HTML NotFound exception than any other unexpected error.
This commit is contained in:
Julian Herrero
2019-01-17 10:47:54 +01:00
committed by Javi Martín
parent 22076dd95c
commit b122302c58
29 changed files with 487 additions and 33 deletions

View File

@@ -46,11 +46,11 @@ class Admin::BudgetGroupsController < Admin::BaseController
private
def load_budget
@budget = Budget.includes(:groups).find(params[:budget_id])
@budget = Budget.find_by_slug_or_id! params[:budget_id]
end
def load_group
@group = @budget.groups.find(params[:id])
@group = @budget.groups.find_by_slug_or_id! params[:id]
end
def groups_index