diff options
author | José Valim <jose.valim@gmail.com> | 2011-12-12 16:23:50 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-12-12 16:23:50 +0100 |
commit | c0466603288252a5db8a4d8cf0ca193004a542ea (patch) | |
tree | 8964e6e5489a646c423cb3ea2fcc98ad0036482d /railties/lib/rails/application.rb | |
parent | c2e3ce8d1e1174e66536d59d8d97eb2cc8ce6f25 (diff) | |
download | rails-c0466603288252a5db8a4d8cf0ca193004a542ea.tar.gz rails-c0466603288252a5db8a4d8cf0ca193004a542ea.tar.bz2 rails-c0466603288252a5db8a4d8cf0ca193004a542ea.zip |
Give hooks the flexibility to choose the type of callback.
Diffstat (limited to 'railties/lib/rails/application.rb')
-rw-r--r-- | railties/lib/rails/application.rb | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 2648476d6d..acbfd7078b 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -115,19 +115,21 @@ module Rails # A plugin may override this if they desire to provide a more # exquisite route reloading. # :api: plugin - def routes_reloader_hook - app = self - lambda { app.routes_reloader.execute_if_updated } + def set_routes_reloader_hook + reloader = routes_reloader + hook = lambda { reloader.execute_if_updated } + hook.call + ActionDispatch::Reloader.to_prepare(&hook) end - # An app reloader hook that is used to setup to_cleanup callbacks. + # An app dependencies hook that is used to setup to_cleanup callbacks. # A plugin may override this if they desire to provide a more exquisite app reloading. # :api: plugin - def app_reloader_hook - lambda { + def set_dependencies_hook + ActionDispatch::Reloader.to_cleanup do ActiveSupport::DescendantsTracker.clear ActiveSupport::Dependencies.clear - } + end end # Initialize the application passing the given group. By default, the |