1
0
Fork 0
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:
Gannon McGibbon 2018-11-09 14:53:56 -05:00 committed by GitHub
commit 27b3b4666c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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