Getting a list of models in a Rails app...

def get_models   models =   Dir.glob( RAILS_ROOT + '/app/models/*' ).each do |f|     models << File.basename( f ).gsub( /^(.+).rb/, '\1')   end   models end

this solution tracks the event of deriving from ActiveRecord::Base. it has very limited capabilities but maybe it’s helpful for you

class Class @@ar_classes = alias :old_inherited :inherited def inherited(cls)

@@ar_classes << cls if cls < ActiveRecord::Base
old_inherited cls

end def self.ar_classes @@ar_classes end end

derived classes can be dumped with >> Class.ar_classes <<

You can use: ActiveRecord::Base.send :subclasses

Depending on your need, you may want to use the approach of looking for the files. Rails does not load models until necessary, so unless all the models have been used, looking for subclasses through any means will not provide you with all your models.

Dan Manges