Permalink
Browse files

Use AD::Reloader.to_cleanup for reloading [#2873 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
1 parent 435bccd commit e683ab7c390f26e110387822c7ffb5ac6aafebca John Firebaugh committed with josevalim Dec 20, 2010
Showing with 6 additions and 10 deletions.
  1. +3 −5 activerecord/lib/active_record/railtie.rb
  2. +3 −5 railties/lib/rails/application/bootstrap.rb
@@ -69,11 +69,9 @@ class Railtie < Rails::Railtie
end
initializer "active_record.set_dispatch_hooks", :before => :set_clear_dependencies_hook do |app|
- unless app.config.cache_classes
- ActiveSupport.on_load(:active_record) do
- ActionDispatch::Callbacks.after do
- ActiveRecord::Base.clear_reloadable_connections!
- end
+ ActiveSupport.on_load(:active_record) do
+ ActionDispatch::Reloader.to_cleanup do
+ ActiveRecord::Base.clear_reloadable_connections!
end
end
end
@@ -51,11 +51,9 @@ module Bootstrap
end
initializer :set_clear_dependencies_hook do
- unless config.cache_classes
- ActionDispatch::Callbacks.after do
- ActiveSupport::DescendantsTracker.clear
- ActiveSupport::Dependencies.clear
- end
+ ActionDispatch::Reloader.to_cleanup do
+ ActiveSupport::DescendantsTracker.clear
+ ActiveSupport::Dependencies.clear
end
end

0 comments on commit e683ab7

Please sign in to comment.