aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/initializer.rb
diff options
context:
space:
mode:
authorTom Ward <tom@popdog.net>2008-08-19 13:19:41 +0100
committerPratik Naik <pratiknaik@gmail.com>2008-08-22 13:06:34 +0100
commit89d1c77dd012f087c091e0f23874c582ea4e3703 (patch)
tree94732218057b59da6eff36a7fadbfada9248c816 /railties/lib/initializer.rb
parent683ff235e6b81d28962f5a71ff53730a1c118fc8 (diff)
downloadrails-89d1c77dd012f087c091e0f23874c582ea4e3703.tar.gz
rails-89d1c77dd012f087c091e0f23874c582ea4e3703.tar.bz2
rails-89d1c77dd012f087c091e0f23874c582ea4e3703.zip
Initializer to sort files before eager loading. [#859 state:resolved]
Changed Rails::Initializer to sort files before eager loading them. This ensures that any files in a parent directory will be loaded before files in a subdirectory of the 'same' name. i.e. zoo.rb will be loaded before zoo/reptile_house.rb Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'railties/lib/initializer.rb')
-rw-r--r--railties/lib/initializer.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb
index 70c6a629ec..ee847e5561 100644
--- a/railties/lib/initializer.rb
+++ b/railties/lib/initializer.rb
@@ -356,7 +356,7 @@ Run `rake gems:install` to install the missing gems.
if configuration.cache_classes
configuration.eager_load_paths.each do |load_path|
matcher = /\A#{Regexp.escape(load_path)}(.*)\.rb\Z/
- Dir.glob("#{load_path}/**/*.rb").each do |file|
+ Dir.glob("#{load_path}/**/*.rb").sort.each do |file|
require_dependency file.sub(matcher, '\1')
end
end