Load budgets using slugs

This commit is contained in:
rgarcia
2017-01-15 21:36:03 +01:00
committed by Javi Martín
parent 0d761ddfb1
commit 998b4d9e39
9 changed files with 69 additions and 31 deletions

View File

@@ -1,4 +1,5 @@
class Management::Budgets::InvestmentsController < Management::BaseController
before_action :load_budget
load_resource :budget
load_resource :investment, through: :budget, class: "Budget::Investment"
@@ -60,6 +61,10 @@ class Management::Budgets::InvestmentsController < Management::BaseController
check_verified_user t("management.budget_investments.alert.unverified_user")
end
def load_budget
@budget = Budget.find_by(slug: params[:budget_id]) || Budget.find_by(id: params[:budget_id])
end
def load_categories
@categories = ActsAsTaggableOn::Tag.category.order(:name)
end