dynamic-nested-attributes

Installation
SKILL.md

Dynamic Nested Attributes

Overview

Implement Rails nested attributes with dynamic add/remove functionality using Turbo Streams and Simple Form. This pattern allows users to add and remove associated records inline within a parent form.

When to Use

  • Building forms where users need to manage multiple child records (has_many associations)
  • Adding/removing nested items without page refresh
  • Bulk creation or editing of associated records
  • Forms requiring progressive disclosure of additional fields

Key Components

1. Form Object or Model

  • Accepts nested attributes for the association
  • Use accepts_nested_attributes_for :association_name in the model or form object

2. Main Form View

Create a form that includes:

Related skills

More from rolemodel/rolemodel-skills

Installs
25
GitHub Stars
5
First Seen
Feb 19, 2026