where to get list of all ActiveRecord classes

I'd like to do something like "ActiveRecord::Base.subclasses" but that gives me:

  pcollins@horatio:~/proj/foobox$ script/console   Loading development environment.   >> ActiveRecord::Base.subclasses   NoMethodError: protected method `subclasses' called ...

You can bypass protected/private restrictions by using send.

ActiveRecord::Base.send(:subclasses)

That will only give you classes that have been loaded already.

Anybody know how to do this? (getting a directory listing doesn't count)

It may be cheating but that's how I've used the directory listing before:

Dir.glob("app/models/*rb")

Aaron

Pablo,

Dir.glob("#{RAILS_ROOT}/app/models/**/*rb").each{|m|
Dependencies.require_or_load m } Object.subclasses_of ActiveRecord::Base

- Lourens