mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #39681 from JuarezLustosa/doc/active_record_validations
[ci skip] Increase info on validate presence for association
This commit is contained in:
commit
d6fda8e019
1 changed files with 2 additions and 0 deletions
|
@ -534,6 +534,8 @@ end
|
|||
In order to validate associated records whose presence is required, you must
|
||||
specify the `:inverse_of` option for the association:
|
||||
|
||||
NOTE: If you want to ensure that the association it is both present and valid, you also need to use `validates_associated`.
|
||||
|
||||
```ruby
|
||||
class Order < ApplicationRecord
|
||||
has_many :line_items, inverse_of: :order
|
||||
|
|
Loading…
Reference in a new issue