title: Rails exclude folder from auto/eager load
body: <p>I want to scale separately some subparts of my rails app and avoid loading the whole codebase.</p>
  
  <p>For the sake of example, let's consider an APIv1 vs an APIv2, but I'd also want to extend this any class/service in general</p>
  
  <p>Is it possible to <strong>exclude</strong> a specific folder from the eager load (production) or autoload (in dev) ?</p>
  
  <p>For example, </p>
  
  <p><code>api-v1-production</code>environment should exclude</p>
  
  <pre><code>controllers/api/v[^1]/**/*.rb
  </code></pre>
  
  <p><code>api-v2-production</code>environment should exclude</p>
  
  <pre><code>controllers/api/v[^2]/**/*.rb
  </code></pre>
  
  <p><em>I am writing [^x] as a convenient notation for everything but x) for the sake of example</em></p>
  
  <p>I know it is possible to <strong>add</strong> some autoload/eager load folders but what about excluding some instead ? (especially if they are inside <code>app/</code> which is autoloaded/eager loaded by default)</p>
  
  <p>I want to avoid loading in memory too many classes/services, etc. that I know won't be useful</p>