From 3bd34b6ffe017dd81fd26743aab052fc4324eb0f Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Sat, 14 Jun 2008 16:24:23 -0500 Subject: Preload application classes. Uses same strategy as phusion passenger. --- railties/lib/initializer.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'railties/lib/initializer.rb') diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb index b8b071d4c9..3be95de8d3 100644 --- a/railties/lib/initializer.rb +++ b/railties/lib/initializer.rb @@ -168,6 +168,9 @@ module Rails # Observers are loaded after plugins in case Observers or observed models are modified by plugins. load_observers + # load application classes + load_application_classes + # Flag initialized Rails.initialized = true end @@ -330,6 +333,14 @@ Run `rake gems:install` to install the missing gems. end end + def load_application_classes + require_dependency 'application' + + Dir.glob('app/{models,controllers,helpers}/*.rb').each do |file| + require_dependency file + end + end + # For Ruby 1.8, this initialization sets $KCODE to 'u' to enable the # multibyte safe operations. Plugin authors supporting other encodings # should override this behaviour and set the relevant +default_charset+ -- cgit v1.2.3