mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #34415 from Ana06/present_associations
Clarify the validation of present associations
This commit is contained in:
commit
27b3b4666c
1 changed files with 2 additions and 1 deletions
|
@ -538,7 +538,8 @@ end
|
|||
|
||||
If you want to be sure that an association is present, you'll need to test
|
||||
whether the associated object itself is present, and not the foreign key used
|
||||
to map the association.
|
||||
to map the association. This way, it is not only checked that the foreign key
|
||||
is not empty but also that the referenced object exists.
|
||||
|
||||
```ruby
|
||||
class LineItem < ApplicationRecord
|
||||
|
|
Loading…
Reference in a new issue