From 89d1c77dd012f087c091e0f23874c582ea4e3703 Mon Sep 17 00:00:00 2001 From: Tom Ward Date: Tue, 19 Aug 2008 13:19:41 +0100 Subject: 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 --- railties/lib/initializer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/lib/initializer.rb') 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 -- cgit v1.2.3