From 791f081a91bc31491eabca9cea36e8d92a3bbf82 Mon Sep 17 00:00:00 2001 From: Bertocq Date: Tue, 23 Jan 2018 23:55:37 +0100 Subject: [PATCH] Rename @budget to @current budget at budget index Clear instance variable names help understand what's going around when you're deep 2 or 3 partials. In this case @budget is only used to carry around the current_budget so @current_budget is more descriptive. Using `current_budget` directly around would be an alternative, but maybe not as maintainable in case we want to change which budget is being shown (for example the drafting one if you're admin). --- app/controllers/budgets_controller.rb | 2 +- app/views/budgets/_phases.html.erb | 4 ++-- app/views/budgets/index.html.erb | 28 +++++++++++++-------------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/app/controllers/budgets_controller.rb b/app/controllers/budgets_controller.rb index 6d3b5e154..8d69b8c98 100644 --- a/app/controllers/budgets_controller.rb +++ b/app/controllers/budgets_controller.rb @@ -15,7 +15,7 @@ class BudgetsController < ApplicationController def index @finished_budgets = @budgets.finished.order(created_at: :desc) - @budget = current_budget + @current_budget = current_budget @budgets_coordinates = current_budget_map_locations end diff --git a/app/views/budgets/_phases.html.erb b/app/views/budgets/_phases.html.erb index 1d0968c46..928ffb993 100644 --- a/app/views/budgets/_phases.html.erb +++ b/app/views/budgets/_phases.html.erb @@ -1,6 +1,6 @@