1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #43710 from CalebJamesStevens/fix-logic-in-form-helper-guide

Fix boolean error in form helpers guide

[ci-skip]
This commit is contained in:
Ryuta Kamizono 2021-11-24 23:34:17 +09:00 committed by GitHub
commit 89b1cc4818
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1021,7 +1021,7 @@ end
### Preventing Empty Records ### Preventing Empty Records
It is often useful to ignore sets of fields that the user has not filled in. You can control this by passing a `:reject_if` proc to `accepts_nested_attributes_for`. This proc will be called with each hash of attributes submitted by the form. If the proc returns `false` then Active Record will not build an associated object for that hash. The example below only tries to build an address if the `kind` attribute is set. It is often useful to ignore sets of fields that the user has not filled in. You can control this by passing a `:reject_if` proc to `accepts_nested_attributes_for`. This proc will be called with each hash of attributes submitted by the form. If the proc returns `true` then Active Record will not build an associated object for that hash. The example below only tries to build an address if the `kind` attribute is set.
```ruby ```ruby
class Person < ApplicationRecord class Person < ApplicationRecord