diff --git a/_posts/2011-12-21-method-missing-best-practice.md b/_posts/2011-12-21-method-missing-best-practice.md index 6877da1..905e88b 100644 --- a/_posts/2011-12-21-method-missing-best-practice.md +++ b/_posts/2011-12-21-method-missing-best-practice.md @@ -76,4 +76,4 @@ Wow, this makes your code ugly, we can use `method missing` instead of these all {% endhighlight %} -When you call `is_[string]` method or `mark_as_[string]` method, as you can see, there is definitely no `is_[string]` or `mark_as_[string]` method, yet Rails is smart enough to call the method with the correct parameters, What we have done is to run a regular expression against the name of the method, and if it matches the pattern `is_[string]` or `mark_as_[string]` then it calls the method with the [string] part as the first parameter and the first argument as the second parameter. Pretty powerful, don’t you think? +When you call `is_[string]` method or `mark_as_[string]` method, as you can see, there is definitely no `is_[string]` or `mark_as_[string]` method, yet Rails is smart enough to call the method with the correct parameters, What we have done is to run a regular expression against the name of the method, and if it matches the pattern `is_[string]` or `mark_as_[string]` then it calls the method with the [string] part as the first parameter and the first argument as the second parameter. Pretty powerful, don't you think?