title: Why do includes in Rails Engine initializers malfunction when cache_classes = false?
body: <p>I have an Engine which is extending another Engine's classes in its initializers like so:</p>
  
  <pre><code>module MyApp
      class Engine &lt; ::Rails::Engine
          initializer 'extend Product' do
              AnotherApp::Product.send :include, MyApp::ProductExtender
          end
      end
  end
  </code></pre>
  
  <p>The <code>ProductExtender</code>module calls some methods on the AnotherApp::Product when it is included, e.g.</p>
  
  <pre><code>module ProductExtender
      def self.included( model )
          model.send :include, MethodsToCall
      end
  
      module MethodsToCall
          def self.included( m )
              m.has_many :variations
          end
      end
  end
  </code></pre>
  
  <p>This works in test and production environments, but when <code>config.cache_classes = false</code>, it throws a <code>NoMethodError</code> at me when I try to call something defined by the ProductExtender, like @product.variations. </p>
  
  <p>Needless to say, it is chilling to see all my tests pass and then get slammed with an error in development. It doesn't happen when I set <code>cache_classes = true</code>, but it makes me wonder if I'm doing something I shouldn't be.</p>
  
  <p>My question is twofold: <strong>Why is this happening, and is there a better way I should be achieving this functionality of extending/calling methods on another application's object?</strong></p>
  
  <p>Thanks all!</p>