title: Rails 6: Zeitwerk::NameError doesn't load class from module
body: <p>I have a file which looks like this</p>
  
  <pre><code>#app/services/account/authenticate/base.rb
  module Account
    module Authenticate
      AuthenticateError = Class.new(StandardError)
  
      class Base &lt; ::Account::Base
        def self.call(*attrs)
          raise NotImplementedError
        end
      end
    end
  end
  </code></pre>
  
  <p>Now when I will run the code from <code>rails c</code> I have an error</p>
  
  <pre><code>&gt; ::Account::Authenticate::AuthenticateError
  =&gt; NameError (uninitialized constant Account::Authenticate::AuthenticateError)
  &gt; ::Account::Authenticate.constants
  =&gt; [:Base, :ViaToken]
  </code></pre>
  
  <p>So rails doesn't see AuthenticateError class. But when I will create a nested class from this folder like</p>
  
  <pre><code>=&gt; Account::Authenticate::ViaToken
  &gt; ::Account::Authenticate.constants
  =&gt; [:Base, :AuthenticateError, :ViaToken]
  </code></pre>
  
  <p>AuthenticateError class is now visible</p>
  
  <pre><code>&gt; ::Account::Authenticate::AuthenticateError
  =&gt; Account::Authenticate::AuthenticateError
  </code></pre>
  
  <p>The solution for this problem is to create a separate file authenticate_error.rb which will work from the beginning but this solution is not ideal for me. Is there any solution to preload all classes or smth?</p>
  
  <p>(Ruby 2.6 with Rails 6.0.0.rc2)</p>