Our great sponsors
-
Cocoon
Dynamic nested forms using jQuery made easy; works with formtastic, simple_form or default forms
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
nested_form_fields
Dynamically add and remove nested has_many association fields in a Ruby on Rails form
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
On a previous project I used Cocoon which makes it simple to add a button that adds an additional set of fields for a nested object.
Anyway, there's also https://github.com/ryanb/nested_form it's no longer developed and uses jquery, but works on rails up to 6.1 (haven't tested it on 7)
I wrote a gem for precisely this purpose :) Super easy setup, and cool generators. Have a look at the docs https://github.com/eki-177/abyme
We are using simple forms in a turbo application. We are making use of stimuli-rails-nested-form controller (https://www.stimulus-components.com/docs/stimulus-rails-nested-form/) and a little helper taken from https://github.com/ncri/nested_form_fields & adapted to our use case: