提交 dcd6ceb0 编写于 作者: M marksiemers 提交者: GitHub

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.
上级 bd3f0e70
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册