Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define respond_to_missing? when overriding method_missing #118

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Define respond_to_missing? when overriding method_missing #118

wants to merge 1 commit into from

Conversation

brandonc
Copy link

When an object responds to a method but says that it doesn't, it can
lead to unexpected behavior. See this article https://robots.thoughtbot.com/always-define-respond-to-missing-when-overriding

> item.id
> "12345"
> item.try(:id)
> nil
> item.respond_to?(:id)
> false

When an object responds to a method but says that it doesn't, it can
lead to unexpected behavior.

```
> item.id
> "12345"
> item.try(:id)
> nil
> item.respond_to?(:id)
> false
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant