What it does
avo-nested
Let your team edit a record and its associations on one form. Nested Records
renders an associated resource inline inside the parent's new and edit
views, so a user fills in an order and its line items, or an author and their
profile, in a single save instead of bouncing between screens. Turn it on
with one option: field :line_items, as: :has_many, nested: true.
It works on has_one,
has_many, and
has_and_belongs_to_many
fields, reusing the associated record's own Avo resource so its fields and
permissions carry over. Scope it to { on: :new },
:edit, or
:forms,
cap how many rows a user can add with limit:,
and lean on your existing accepts_nested_attributes_for.
Nested attributes, dynamic add and remove rows, and the right strong params
are already built and vetted; your agent adds one option instead of generating them.
What you get
-
Capture a record and everything attached to it on one form, whether the association is
has_one,has_many, orhas_and_belongs_to_many - Nested records reuse their own Avo resource, so the fields, validations, and permissions you already defined apply without restating them
- Users build out rows right on the page, with no reload, so entering an order and its ten line items feels like one task instead of eleven
-
Show nesting only where it earns its place by scoping it to
:new,:edit, or:formswithnested: { on: ... } -
Keep big forms manageable by capping rows with
limit:, which hides the add button once the cap is reached -
Sits on top of
accepts_nested_attributes_forand permits the nested strong params for you, so there is no params plumbing left to maintain
Why it pays off
-
Ship edit-the-whole-tree forms this afternoon instead of generating
fields_for, nested params, and add/remove JavaScript from scratch. - Nested attributes and strong params are easy to get subtly wrong; here they are built for many apps, reviewed by people, and fixed once for everyone.
- Every Avo release makes it better: it reuses your existing resources and keeps working through upgrades, so the nested forms your agent set up never get stranded.
- Tokens, time, and focus go to your product, not to a form builder generated from scratch in every app.