title: Optimizing Rails loading for maintenance scripts
body: <p>I wrote a script that does maintenance tasks for a rails application. The script uses a class that uses models defined in the application. Just an example, let's say application defines model User, and my class (used within the script), sends messages to it, like User.find id.</p>
  
  <p>I am looking for ways to optimize this script, because right now it has to load the application environment: <code>require '../config/environment'</code>. This takes ~15 seconds.</p>
  
  <p>Had the script not use application codebase to do its job, I could have replaced model abstractions with raw SQL. But unfortunatly I can't do that because I would have to repeat the code in the script that is already present in the codebase. Not only would this violate  DRY principle and require alot of work, the script would not be very maintainable, in case the model methods that I am using change.</p>
  
  <p>I would like to hear ideas how to approach this problem. The script is not run from the application itself, but from the shell (with Capistrano for instance).</p>
  
  <p>I hope I've described the problem clear enough. Thank you.</p>