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

@@ -62,7 +62,7 @@ class Management::Budgets::InvestmentsController < Management::BaseController
end
def load_budget
@budget = Budget.find_by(slug: params[:budget_id]) || Budget.find_by(id: params[:budget_id])
@budget = Budget.find_by_slug_or_id! params[:budget_id]
end
def load_categories