How do I eagerly load all dependencies in a Rails (2.x) script?
===

I've got a script in a Rails 2 application that involves performing a lot of tasks in parallel (using the [parallel][1] gem) with threads. What I'm running into is an issue with uninitialized constants due to the way Rails (or ActiveSupport?) loads dependencies.

My online research has indicated to me that I'm probably supposed to use `config.threadsafe!` or something of that nature to address this issue. The problem there, though, is that I don't want to change the way the entire application works (by changing environment.rb) since the use of threads is really localized to this one script.

What I'd done thus far is simply initialize as many constants as I know I need before creating any new `Thread` objects:

    constants_to_load = [
      User,
      Merchant,
      Loggable,
      UserMailer,
      # etc.
    ]

    # code involving threads

This is clearly not a good approach, as it's based entirely on my own guesstimated list of what constants need to be loaded (mostly from reactively adding constants whenever I encounter an exception) and is about as far from future-proof as it gets. Is it possible to just say something like "Load everything I could possibly need"? I know that probably sounds bad; it just seems like the most fool-proof approach to me. But if there's another way to do this right, I'm all ears.

  [1]: https://github.com/grosser/parallel