Permalink
Browse files

It's best to define respond_to_missing instead of respond_to?

  • Loading branch information...
1 parent 39eea48 commit 06fdafc65aedfd496505906732acc7df79efdaee @marcandre marcandre committed May 5, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 README.md
View
@@ -1389,7 +1389,7 @@ patch them.)
```
* avoid using `method_missing` for metaprogramming. Backtraces become messy; the behavior is not listed in `#methods`; misspelled method calls might silently work (`nukes.launch_state = false`). Consider using delegation, proxy, or `define_method` instead. If you must, use `method_missing`,
- - be sure to [also define `respond_to?`](http://devblog.avdi.org/2011/12/07/defining-method_missing-and-respond_to-at-the-same-time/)
+ - be sure to [also define `respond_to_missing?`](http://blog.marc-andre.ca/2010/11/methodmissing-politely.html)
- only catch methods with a well-defined prefix, such as `find_by_*` -- make your code as assertive as possible.
- call `super` at the end of your statement
- delegate to assertive, non-magical methods:

0 comments on commit 06fdafc

Please sign in to comment.