title: Zeitwerk::NameError due to Module name in rails 7
body: <p>I recently upgraded my application from rails 6 to 7 and I am facing one issue due to zeitwerk naming convention. I have a below file which I want to autoload:</p>
  <pre><code>app/models/dw/hospital.rb
  
  module DW
    class Hospital &lt; DataWarehouse
      def self.columns
        super.reject{|column| column.name == 'tableau_user' }
      end
    end
  end
  </code></pre>
  <p>I tried autoloading this file by adding the following line in my <code>application.rb</code> file:</p>
  <pre><code>config.autoload_once_paths &lt;&lt; 'app/models/dw'
  </code></pre>
  <p>But when I am starting the server I am getting the following error:</p>
  <pre><code>expected file app/models/dw/hospital.rb to define constant Hospital, but didn't (Zeitwerk::NameError)
  </code></pre>
  <p>I'm not sure why this is throwing such error since the constant is already defined. I suspect it is because the module I have defined before the class. Please let me know if anybody how to fix this. I have been stuck at this far too long.</p>