while building a small CMS I now have the problem to create some
content elements. To be able to make a selectbox (or something
similar), I have to figure out, which content elements (each has its
own model-class) exist.
My plan was to extend the model-classes with some kind of module to
add some common methods and use
self.included(class) in the module to get all classes which include
this module. But the problem is, that this method is only called when
an instance of the class is created.
So the question is, how do I fetch all classes? Is there a common way
to do this and/or do I have to iterate over the files and read this
out (and how is this done )?