How can I iterate through all of the Models in my rails app?

Posted by James on Stack Overflow See other posts from Stack Overflow or by James
Published on 2010-05-01T23:11:00Z Indexed on 2010/05/01 23:17 UTC
Read the original article Hit count: 136

Filed under:
|
|

I would like to be able to iterate over and inspect all the models in my rails app. In pseudo-code it would look something like:

rails_env.models.each do |model|  
  associations = model.reflect_on_all_associations(:has_many)  
  ... do some stuff  
end

My question is how do I inspect my rails app to get a collection of the models (rails_env.models) ?

© Stack Overflow or respective owner

Related posts about rails

Related posts about models