Files
grecia/app/helpers/budget_headings_helper.rb
Javi Martín d0d681a44b Add and apply EmptyLineAfterGuardClause rule
We were inconsistent on this one. I consider it particularly useful when
a method starts with a `return` statement.

In other cases, we probably shouldn't have a guard rule in the middle of
a method in any case, but that's a different refactoring.
2019-10-24 17:56:03 +02:00

15 lines
437 B
Ruby

module BudgetHeadingsHelper
def budget_heading_select_options(budget)
budget.headings.sort_by_name.map do |heading|
[heading.name_scoped_by_group, heading.id]
end
end
def heading_link(assigned_heading = nil, budget = nil)
return nil unless assigned_heading && budget
heading_path = budget_investments_path(budget, heading_id: assigned_heading&.id)
link_to(assigned_heading.name, heading_path)
end
end