%# Usage: render 'content/form/relation_input', f: f, attribute: attribute, relation: through_class %>
<%= f.label attribute, I18n.translate(
"attributes.#{f.object.class.name.downcase}.#{attribute}",
scope: :activerecord,
default: label.humanize.capitalize
) %>
<%= f.fields_for relation do |builder| %>
<%= render 'content/form/groupship_fields', f: builder, attribute: attribute.singularize, parent: f.object %>
<% end %>
<% model_class = f.object.send(attribute).build.class %>
<% color = model_class.color %>
<%= link_to_add_association "link #{model_class.name.downcase}", f, relation,
class: "btn #{color}",
partial: 'content/form/groupship_fields',
render_options: { locals: {
attribute: attribute.singularize,
parent: f.object
}} %>