diff options
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/application.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails/application/finisher.rb | 8 | ||||
-rw-r--r-- | railties/lib/rails/console/app.rb | 3 | ||||
-rw-r--r-- | railties/test/application/console_test.rb | 8 |
4 files changed, 12 insertions, 9 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 3b7505ce37..149c63cd9e 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -157,7 +157,7 @@ module Rails middleware.use ::ActionDispatch::RemoteIp, config.action_dispatch.ip_spoofing_check, config.action_dispatch.trusted_proxies middleware.use ::Rack::Sendfile, config.action_dispatch.x_sendfile_header middleware.use ::ActionDispatch::Reloader unless config.cache_classes - middleware.use ::ActionDispatch::Callbacks, !config.cache_classes + middleware.use ::ActionDispatch::Callbacks middleware.use ::ActionDispatch::Cookies if config.session_store diff --git a/railties/lib/rails/application/finisher.rb b/railties/lib/rails/application/finisher.rb index e3342be7ee..a45b61c99c 100644 --- a/railties/lib/rails/application/finisher.rb +++ b/railties/lib/rails/application/finisher.rb @@ -21,7 +21,7 @@ module Rails initializer :add_to_prepare_blocks do config.to_prepare_blocks.each do |block| - ActionDispatch::Callbacks.to_prepare(&block) + ActionDispatch::Reloader.to_prepare(&block) end end @@ -37,6 +37,10 @@ module Rails build_middleware_stack end + initializer :run_prepare_callbacks do + ActionDispatch::Reloader.prepare! + end + initializer :eager_load! do if config.cache_classes && !$rails_rake_task ActiveSupport.run_load_hooks(:before_eager_load, self) @@ -52,7 +56,7 @@ module Rails initializer :set_routes_reloader do |app| reloader = lambda { app.routes_reloader.execute_if_updated } reloader.call - ActionDispatch::Callbacks.to_prepare(&reloader) + ActionDispatch::Reloader.to_prepare(&reloader) end # Disable dependency loading during request cycle diff --git a/railties/lib/rails/console/app.rb b/railties/lib/rails/console/app.rb index 9d9763699d..4a988efd82 100644 --- a/railties/lib/rails/console/app.rb +++ b/railties/lib/rails/console/app.rb @@ -26,7 +26,6 @@ end # reloads the environment def reload!(print=true) puts "Reloading..." if print - # This triggers the to_prepare callbacks - ActionDispatch::Callbacks.new(Proc.new {}, false).call({}) + ActionDispatch::Reloader.reload! true end diff --git a/railties/test/application/console_test.rb b/railties/test/application/console_test.rb index d4159dd0fd..5f84c2b948 100644 --- a/railties/test/application/console_test.rb +++ b/railties/test/application/console_test.rb @@ -26,14 +26,14 @@ class ConsoleTest < Test::Unit::TestCase assert_instance_of ActionDispatch::Integration::Session, session end - def test_reload_should_fire_preparation_callbacks + def test_reload_should_fire_preparation_and_cleanup_callbacks load_environment a = b = c = nil # TODO: These should be defined on the initializer - ActionDispatch::Callbacks.to_prepare { a = b = c = 1 } - ActionDispatch::Callbacks.to_prepare { b = c = 2 } - ActionDispatch::Callbacks.to_prepare { c = 3 } + ActionDispatch::Reloader.to_prepare { a = b = c = 1 } + ActionDispatch::Reloader.to_prepare { b = c = 2 } + ActionDispatch::Reloader.to_cleanup { c = 3 } # Hide Reloading... output silence_stream(STDOUT) { reload! } |