This project is archived and is in readonly mode.

#4357 ✓resolved
Kim Altintop

defaults for eager_load_paths and load_once_paths overwrite each other (typo?)

Reported by Kim Altintop | April 9th, 2010 @ 12:28 PM | in 3.0.2

Defaults for eager_load_paths and load_once_paths are assigned to the same instance variable of Rails::Engine::Configuration (@eager_load_paths), which may cause classes to be reloaded in dev mode even if their paths where explicitly configured as load_once_paths. This is an issue especially with JRuby-based Rails applications which make use of Java libraries and may rely on singletons / must avoid attempts to reload jar files.

The following simple patch fixes the problem:

diff --git a/railties/lib/rails/engine/configuration.rb b/railties/lib/rails/engine/configuration.rb
index 28e7ef9..c5411a0 100644
--- a/railties/lib/rails/engine/configuration.rb
+++ b/railties/lib/rails/engine/configuration.rb
@@ -43,7 +43,7 @@ module Rails
       end

       def load_once_paths
-        @eager_load_paths ||= paths.load_once
+        @load_once_paths ||= paths.load_once
       end

       def load_paths

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Referenced by

Pages