Merge pull request #46662 from adityapandit17/form-helper-guide-fixes
Fixed form helper documentation [ci-skip]
This commit is contained in:
commit
a02c23578e
@ -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.
|
||||||
|
Loading…
Reference in New Issue
Block a user