From 29dadc91ac945bd5639137bc4875e410055ca865 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Checa?= Date: Wed, 21 Mar 2018 20:18:47 +0100 Subject: [PATCH] Change Budget::Investment::Milestones controller Added `:status_id` to valid params and new method to get all statuses defined for the budget. --- .../admin/budget_investment_milestones_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin/budget_investment_milestones_controller.rb b/app/controllers/admin/budget_investment_milestones_controller.rb index d2fdf5700..d54dc0174 100644 --- a/app/controllers/admin/budget_investment_milestones_controller.rb +++ b/app/controllers/admin/budget_investment_milestones_controller.rb @@ -3,6 +3,7 @@ class Admin::BudgetInvestmentMilestonesController < Admin::BaseController before_action :load_budget_investment, only: [:index, :new, :create, :edit, :update, :destroy] before_action :load_budget_investment_milestone, only: [:edit, :update, :destroy] + before_action :load_statuses, only: [:index, :new, :create, :edit, :update] def index end @@ -45,7 +46,7 @@ class Admin::BudgetInvestmentMilestonesController < Admin::BaseController def milestone_params image_attributes = [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy] documents_attributes = [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy] - attributes = [:title, :description, :publication_date, :budget_investment_id, + attributes = [:title, :description, :publication_date, :budget_investment_id, :status_id, image_attributes: image_attributes, documents_attributes: documents_attributes] params.require(:budget_investment_milestone).permit(*attributes, translation_params(params[:budget_investment_milestone])) @@ -71,4 +72,8 @@ class Admin::BudgetInvestmentMilestonesController < Admin::BaseController get_milestone end + def load_statuses + @statuses = Budget::Investment::Status.all + end + end