title: Rails can't find my classes after a while
body: <p>I have a custom module with a class in Rails. I put this in my autoload inside the application.rb</p>
  
  <p><code>config.autoload_paths &lt;&lt; "#{Rails.root}/classes"</code></p>
  
  <p>The module has a reference to a file in a deeper folder:</p>
  
  <p>a.rb</p>
  
  <pre><code>require_relative './b/b.rb'
  
  module A
  
    def self.abc content
      return A::B.new
    end
  
  end
  </code></pre>
  
  <p>B has nothing fancy:</p>
  
  <p>b.rb</p>
  
  <pre><code>module A
  
    class B
      def initialize
      end
    end
  end
  </code></pre>
  
  <p>What's happening right now is that in the beginning this works perfectly, but after some requests, or a certain amount of time, it stops working and I get an: <code>uninitialized constant A::B</code> error.</p>
  
  <p>Any ideas? The fact that it works in the beginning is confusing me. Thanks in advance.</p>