Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/julianrubisch/sr-nested-form-reflex
https://github.com/julianrubisch/sr-nested-form-reflex
Last synced: 10 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/julianrubisch/sr-nested-form-reflex
- Owner: julianrubisch
- License: mit
- Created: 2021-05-03T12:30:33.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-05-04T10:14:56.000Z (over 3 years ago)
- Last Synced: 2024-12-12T14:34:35.479Z (15 days ago)
- Language: Ruby
- Size: 29.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
A reflex to construct a form that wraps a `has_many` relationship with nested attributes on the fly.
**How?**
- New children are instantiated by calling `.build` on the `has_many` association
- `fields_for` expands to all children if a `child_attributes=` setter is present (which is the case if `accepts_nested_attributes_for` is set) - see [API docs](https://api.rubyonrails.org/classes/ActionView/Helpers/FormBuilder.html#method-i-fields_for)**Caveat**
Clean up your session (or other persistent store) after form submission.