How can I get model names from inside my app?

Posted by Cameron on Stack Overflow See other posts from Stack Overflow or by Cameron
Published on 2010-05-04T18:55:34Z Indexed on 2010/05/04 18:58 UTC
Read the original article Hit count: 166

Filed under:

I have a bunch of models in a sub-directory that inherit from a model in the models root directory. I want to be able to set a class variable in another model that lists each inherited model class.

i.e

@@groups = sub_models.map do { |model| model.class.to_s }

Not sure how to get at this info though...

© Stack Overflow or respective owner

Related posts about ruby-on-rails