3 ms·
"I use method_missing()to remove duplication ... On the other hand, I usually think twice about using method_missing() for cosmetic reasons, like getting cool m
by joshd 16y ago
"I use method_missing()to remove duplication ... On the other hand, I usually think twice about using method_missing() for cosmetic reasons, like getting cool method names such as find_by_name_and_address()."
That seems backwards to me. I use magic methods to define methods that can only be defined at run time, like his example of creating methods based on schema introspection.
Using magic methods breaks a lot of tools: IDE code completion, reflection, documentation generation so I always explicitly define methods unless it's not possible.