diff options
author | Joshua Peek <josh@joshpeek.com> | 2010-01-16 16:14:35 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2010-01-16 16:15:32 -0600 |
commit | 603d4fbacd69d95987d3f7fed91631e481f5a1cf (patch) | |
tree | 22fa709f1fea0b146083706cace34e37b3f51408 /railties/lib | |
parent | dba196cb7f8d34b93f6872e4a43737bb52019065 (diff) | |
download | rails-603d4fbacd69d95987d3f7fed91631e481f5a1cf.tar.gz rails-603d4fbacd69d95987d3f7fed91631e481f5a1cf.tar.bz2 rails-603d4fbacd69d95987d3f7fed91631e481f5a1cf.zip |
Build middleware stack and reload routes after app initializers run
[#3709 state:resolved]
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/application.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index c95316a4da..4d05f8115c 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -99,9 +99,15 @@ module Rails end end + def app + @app ||= begin + reload_routes! + middleware.build(routes) + end + end + def call(env) - @app ||= middleware.build(routes) - @app.call(env) + app.call(env) end initializer :load_application_initializers do @@ -110,6 +116,10 @@ module Rails end end + initializer :build_middleware_stack do + app + end + # Fires the user-supplied after_initialize block (Configuration#after_initialize) initializer :after_initialize do config.after_initialize_blocks.each do |block| |