Files
grecia/app/components/admin/budget_groups/groups_component.rb
Javi Martín 6a2c01b119 Extract method to render an admin table action
This way it will be easier to change the behavior of all table actions,
like adding ARIA attributes. In the past, when we changed the behavior
of the `link_to` method, we had to change all table action classes.
2021-09-20 20:27:37 +02:00

19 lines
358 B
Ruby

class Admin::BudgetGroups::GroupsComponent < ApplicationComponent
include Admin::Namespace
attr_reader :groups
def initialize(groups)
@groups = groups
end
private
def budget
@budget ||= groups.first.budget
end
def headings_path(group)
send("#{namespace}_budget_group_headings_path", group.budget, group)
end
end