Conversation
|
@estum thank you for your work. Would you mind sharing some use-cases where you can see this being useful? |
|
@senny I was missing a method like |
There was a problem hiding this comment.
We should probably return false instead of nil here to maintain convention with most Ruby .exist? functions.
There was a problem hiding this comment.
@ianks that's not necessary. Rails does not make the promise of returning real booleans from predicate methods.
There was a problem hiding this comment.
Is there a particular reason for now? I would consider it an anti-pattern to return nil from a predicate method as it makes it harder to reason about the function.
There was a problem hiding this comment.
@ianks there is a section on booleans in our API documentation guidelines.
Add `foreign_key_exists?` method.
|
@estum great work! 💛 I added a CHANGELOG entry and made some minor changes in the merge commit (removed trailing whitespace, replaced The extraction of |
There was a problem hiding this comment.
@senny Is this # :nodoc: intentional? Or should we make this method publicly documented?
There was a problem hiding this comment.
@claudiob I think it was due to the fact that foreign_key had a no-doc as well. It was previously only used by references. Should be fine to document them though.
No description provided.