Merge pull request #46662 from adityapandit17/form-helper-guide-fixes

Fixed form helper documentation [ci-skip]
This commit is contained in:
Jonathan Hefner 2022-12-08 13:07:20 -06:00 committed by GitHub
commit a02c23578e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -870,10 +870,10 @@ Which will result in a `params` hash that looks like:
``` ```
All of the form inputs map to the `"person"` hash because we called `fields_for` All of the form inputs map to the `"person"` hash because we called `fields_for`
on the `person_form` form builder. By specifying an `:index` option, we mapped on the `person_form` form builder. Also, by specifying `index: address.id`, we
the address inputs to `person[address][#{address.id}][city]` instead of rendered the `name` attribute of each city input as `person[address][#{address.id}][city]`
`person[address][city]`. Thus we are able to determine which Address records instead of `person[address][city]`. Thus we are able to determine which Address
should be modified when processing the `params` hash. records should be modified when processing the `params` hash.
You can pass other numbers or strings of significance via the `:index` option. You can pass other numbers or strings of significance via the `:index` option.
You can even pass `nil`, which will produce an array parameter. You can even pass `nil`, which will produce an array parameter.