loads ballot in budget_investments_controller

This commit is contained in:
kikito
2016-12-22 20:25:17 +01:00
parent 430507ec1e
commit 15fade5660

View File

@@ -4,6 +4,7 @@ class Admin::BudgetInvestmentsController < Admin::BaseController
before_action :load_budget
before_action :load_investment, only: [:show, :edit, :update]
before_action :load_ballot, only: [:show, :index]
has_filters %w{valuation_open without_admin managed valuating valuation_finished all}, only: :index
@@ -57,4 +58,10 @@ class Admin::BudgetInvestmentsController < Admin::BaseController
def load_tags
@tags = ActsAsTaggableOn::Tag.budget_investment_tags
end
end
def load_ballot
if @budget.balloting?
@ballot = Budget::Ballot.where(user: current_user, budget: @budget).first_or_create
end
end
end