Topic: method_missing feature

when do we need to use it? what does it realy good for? what is the typical use case?

Thanks in advance

Re: method_missing feature

Here's a great example.  Have you used the "find_by_my_column" feature on a model?  That method doesn't actually exist, rather Active Record uses the method_missing feature to catch all methods that start with find_by, and dynamically extract the last part and turn it into a query.

It actually opens a lot of cool new possibilities.

Re: method_missing feature

so the method_missing feature will implement " to catch all methods that start with find_by, and dynamically extract the last part and turn it into a query."??

Re: method_missing feature

The method_missing feature will catch any method that is called on an object but not found.  You create a method called 'method_missing' and you get the name of the method called, and any arguments passed to it.  If someone calls a method that doesn't exist, the method_missing method will be called, and you can do anything you want with it.

http://ruby-doc.org/core/classes/Kernel.html#M005929

Re: method_missing feature

method_missing method is used for dynamic finders such as find_by_attr, find_all_by_attr