On Wed, Dec 24, 2008 at 1:32 AM, Matt W. email@example.com wrote:
Is that some kind of trick to create multiple
Not really in that particular case. Ruby modules generally allow you to do
multiple inheritance by ‘mixing in’ behaviour to classes, but that would be
when you use ‘include’ to bring the methods defined in the module into the
When you inherit from a class, you inherit both its instance methods and
class methods. When you include a module, you (usually) just inherit its
instance methods. The trick under discussion just makes sure you inherit
modules “class methods” as well, making it as if you inherited normally.
Is there any way without digging thru source to know which
class include methods from other classes or do y’all just get so cozy
with every Rails class you use that you “just know?”
ancestors tells you a class’s superclasses (including modules).