Skip to content

Commit 3bd34b6

Browse files
committed
Preload application classes. Uses same strategy as phusion passenger.
1 parent 0f43de6 commit 3bd34b6

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

railties/lib/initializer.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ def process
168168
# Observers are loaded after plugins in case Observers or observed models are modified by plugins.
169169
load_observers
170170

171+
# load application classes
172+
load_application_classes
173+
171174
# Flag initialized
172175
Rails.initialized = true
173176
end
@@ -330,6 +333,14 @@ def load_observers
330333
end
331334
end
332335

336+
def load_application_classes
337+
require_dependency 'application'
338+
339+
Dir.glob('app/{models,controllers,helpers}/*.rb').each do |file|
340+
require_dependency file
341+
end
342+
end
343+
333344
# For Ruby 1.8, this initialization sets $KCODE to 'u' to enable the
334345
# multibyte safe operations. Plugin authors supporting other encodings
335346
# should override this behaviour and set the relevant +default_charset+

0 commit comments

Comments
 (0)