mirror of https://github.com/rails/rails
Update 'Building Complex Forms' with `inverse_of`
If the example for complex forms is implemented, ActiveRecord will prevent saving unless `inverse_of: :person` is added to the `has_many :addresses` association.
This commit is contained in:
parent
bd3f0e706c
commit
dcd6ceb0c9
|
@ -877,7 +877,7 @@ Active Record provides model level support via the `accepts_nested_attributes_fo
|
|||
|
||||
```ruby
|
||||
class Person < ApplicationRecord
|
||||
has_many :addresses
|
||||
has_many :addresses, inverse_of: :person
|
||||
accepts_nested_attributes_for :addresses
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue