diff options
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/initializer.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb index 96e9adebc8..8a5ca6f91b 100644 --- a/railties/lib/initializer.rb +++ b/railties/lib/initializer.rb @@ -674,8 +674,10 @@ module Rails # # See Dispatcher#to_prepare. def to_prepare(&callback) - require 'dispatcher' unless defined?(::Dispatcher) - Dispatcher.to_prepare(&callback) + after_initialize do + require 'dispatcher' unless defined?(::Dispatcher) + Dispatcher.to_prepare(&callback) + end end def builtin_directories |