title: Chaining autoloaded classes in Ruby
body: <p>I have a class, <code>User</code> in <code>user.rb</code> that will be autoloaded as needed by the following statement:</p>
  
  <pre><code>autoload :User, 'models/user.rb'
  </code></pre>
  
  <p>This model is shared between a few different codebases (as a Git submodule, if that makes a difference). In one such codebase, I have a need to reopen the <code>User</code> class and add some methods. Where this gets complicated, for me at least, is that I need the resultant, extended class to be autoloaded in place of the original class.</p>
  
  <p>Is there a pattern for chaining autoloaded classes in Ruby? Something like:</p>
  
  <pre><code>autoload :User, ['models/user.rb', 'extended_models/user.rb']
  </code></pre>
  
  <p>Or should I be using inheritance instead of monkey-patching? I'm open to suggestions. Thanks in advance.</p>