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_namein the model or form object