I have a custom FormBuilder that has a group method that acts as a wrapper around each label/input/hint/error combo. The group method itself is very simple, but when I try to use it from ERB like I would with “fields_for” or similar, it does not render properly.
def group(**options, &)
options[:class] = class_names(options[:class] || "flex flex-col mt-4", options.delete(:classes))
content_tag(:div, capture(&), **options)
end
In the component that is using the form helper I can do the following just fine
def call
@form.group(**@group) do
concat @form.label(:tags, @label.delete(:text), **@label)
concat @form.text_field(:tags, **@system_arguments)
end
end
But if I try to write that in an ERB partial, it either does not render the wrapper from group at all, or it only renders the text_field and not the label
<%= @form.group(**@group) do %>
<%= @form.label(:tags, @label.delete(:text), **@label) %>
<%= @form.text_field(:tags, **@system_arguments) %>
<% end %>
Not sure what I’m missing to get the ERB version to work properly…