How can I force Rails to load all models?

Viewed 10603

Rails does model loading on demand. For a rake task that I'm writing, I need to be able to iterate over all ActiveRecord::Base instances (which is possible with ActiveRecord::Base.send(:subclasses)).

However, for the above to work, they have to already be loaded. Anyone know of a way to force all models to load? Ideally I'd like to not have to poke through app/models since I'd like to catch models added by plugins as well.

2 Answers
Related