diff options
author | José Valim <jose.valim@gmail.com> | 2010-09-02 12:54:16 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-09-02 12:54:21 +0200 |
commit | 48bf667a8b1c489bd6edff0b8322324a7a1b06bc (patch) | |
tree | 0abae7b918253749988d4e575b31e405e41dfac7 /railties/lib/rails/application | |
parent | 38a421b34d0b414564e919f67d339fac067a56e6 (diff) | |
download | rails-48bf667a8b1c489bd6edff0b8322324a7a1b06bc.tar.gz rails-48bf667a8b1c489bd6edff0b8322324a7a1b06bc.tar.bz2 rails-48bf667a8b1c489bd6edff0b8322324a7a1b06bc.zip |
Ensure routes are loaded only after the initialization process finishes, ensuring all configuration options were applied.
Diffstat (limited to 'railties/lib/rails/application')
-rw-r--r-- | railties/lib/rails/application/finisher.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/railties/lib/rails/application/finisher.rb b/railties/lib/rails/application/finisher.rb index 855467227b..8fd2aa0bce 100644 --- a/railties/lib/rails/application/finisher.rb +++ b/railties/lib/rails/application/finisher.rb @@ -46,6 +46,13 @@ module Rails ActiveSupport.run_load_hooks(:after_initialize, self) end + # Force routes to be loaded just at the end and add it to to_prepare callbacks + initializer :set_routes_reloader do |app| + reloader = lambda { app.routes_reloader.execute_if_updated } + reloader.call + ActionDispatch::Callbacks.to_prepare(&reloader) + end + # Disable dependency loading during request cycle initializer :disable_dependency_loading do if config.cache_classes && !config.dependency_loading |