Footer partial
See this comment in #121, we currently have <%= link_to('Delete', draw_group_path(@draw, @group), method: :delete) if policy(@group).destroy? %>
, but I feel like that can easily be extended to other resources. Maybe a helper method for the destroy_path
and passing in the resource as a local variable, something like:
# app/views/application/_footer.html.erb
<%= link_to('Delete', destroy_path(object), method: :delete) if policy(object).destroy? %>
# app/helpers/groups_helper.rb
module GroupsHelper < ApplicationHelper
def destroy_path(group)
draw_group_path(group.draw, group)
end
end
# app/views/groups/show.html.erb
...
<%= render partial: 'footer', object: @group %>
Edited by Oren Kanner