Simplify scope usage

Rails automatically calls the `id` method inside scopes and the variable
name makes more sense if it represents investments instead of the number
of investments.
This commit is contained in:
Javi Martín
2018-12-21 17:16:51 +01:00
parent 10e8117f83
commit b0f1b6245e
2 changed files with 4 additions and 5 deletions

View File

@@ -7,10 +7,9 @@ class Valuation::BudgetsController < Valuation::BaseController
def index
@budget = current_budget
if @budget.present?
@investments_with_valuation_open = @budget.investments
.by_valuator(current_user.valuator.try(:id))
.valuation_open
.count
@investments = @budget.investments
.by_valuator(current_user.valuator)
.valuation_open
end
end
end

View File

@@ -18,7 +18,7 @@
<%= t("budgets.phase.#{@budget.phase}") %>
</td>
<td>
<%= @investments_with_valuation_open %>
<%= @investments.count %>
</td>
<td>
<%= link_to t("valuation.budgets.index.evaluate"),