title: LoadError Unable to autoload constant ( Rails Engine )
body: <p>Whenever i hit the endpoints (example: greet ) exposed by rails engine i receive this error.</p>
  
  <p>Error: </p>
  
  <pre><code>"LoadError(Unable to autoload constant TestingController, 
  expected /local_path/app/controllers/testing_controller.rb to define it): 
  /Users/xxxxx/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.1/lib/active_support/
  dependencies.rb:507:in `load_missing_constant'"
  </code></pre>
  
  <p>Engine:</p>
  
  <p>I have an engine with action method <code>greet</code> defined as below</p>
  
  <pre><code># type: class
  # path: app/controllers/testing_controller.rb
  # file name: testing_controller.rb 
  module Parent
    module Child
      class TestingController &lt; ApplicationController
        def initialize
          @name = 'BOB'
        end
  
        def greet
          render json: {'hi': 'hi', 'name': @name}
        end
      end
    end
  end
  </code></pre>
  
  <p>routes defined as</p>
  
  <pre><code># type: route
  # path: app/config/routes.rb
  # file name: routes.rb 
  Parent::Child::Engine.routes.draw do
    get 'greet', to: 'testing#greet', as: :greet
  end
  </code></pre>
  
  <p>Details:</p>
  
  <p>This engine has been mounted to a gem <code>ABC</code> which is then used in the rails app called <code>Example</code>. When i hit the <code>greet</code> route in the app via 
  <a href="http://localhost:3000/greet" rel="nofollow noreferrer">http://localhost:3000/greet</a> for the first time i receive <code>LoadError</code>. </p>
  
  <p>However if i refresh the page it renders the 
  json as expected. <code>{"hi":"hi","name":"BOB"}</code>. </p>
  
  <p>we have <code>development.rb</code> (app/config/env/) has cache and eager load defined as below</p>
  
  <pre><code>config.cache_classes = false
  config.eager_load = false
  </code></pre>
  
  <p>Ruby: 2.5.1<br>
  Rails: 5.2.1</p>
  
  <p>Thanks for your help, much appreciated.</p>