The noteworthy changes for each ViewPartialFormBuilder version are included here. For a complete changelog, see the commits for each version via the version links.
Drop end-of-life Ruby versions 2.7 and 3.0.
Drop end-of-life Rails versions 6.1 and 7.0
Expand matrix of supported versions to include [email protected]
and [email protected]
.
Add test coverage for field_id
and field_name
, and delegate to view context
Implement the FormBuilder
interface by proxying its underlying view
@template
instance to ViewPartialFormBuilder::TemplateProxy
.
Remove support for partial:
option to override which partial is to be rendered
by ViewPartialFormBuilder::FormBuilder
.
Remove support for declaring option keys as partial-local variables.
Remove support for *arguments
in a view partial.
Remove support for merge_token_lists
.
Deprecate root-level declarations in app/views/form_builder/
in favor of
app/views/application/form_builder/
.
Deprecate support for declaring options keys as partial-local variables.
It will be removed in the 0.2.0
release.
Deprecate support for *arguments
in a view partial.
It will be removed in the 0.2.0
release.
Deprecate the use of partial:
to override which partial to be rendered by
ViewPartialFormBuilder::FormBuilder
. Instead, rely on Rails' controller and
ActiveModel partial scope resolution prefixing.
Deprecate the use of merge_token_lists
to combine attributes that are backed
by DOMTokenList. It will be removed in the 0.2.0
release.
Improve support for fields_for
and fields
calls to cascade partial
resolution from most-specific to most-general.
Add missing support for date_select
method.
Use ActionView::Template instances to render templates instead of
ActionView::Helpers::RenderingHelper-provided render()
method.
Bugfix: when a partial (for example,
app/views/application/_my_text_field.html.erb
) called the
ViewPartialFormBuilder
method ending in the same name (in this example:
app/views/form_builder/_text_field.html.erb
), infinite recursion protection
would kick in, and the field partial would not be rendered.
Passing a partial:
key can be useful for layering partials on top of one
another. Enable rendering partials within partials:
<%# app/views/admin/form_builder/_search_field.html.erb %>
<%= form.search_field(
*arguments,
partial: "form_builder/search_field",
**options.merge_token_lists(
class: "search-field--admin",
"data-controller": "focus->admin-search#clearResults",
),
) %>
Construct <form>
elements and their fields by combining
ActionView::Helpers::FormBuilder
with Rails View
Partials.