diff options
author | José Valim <jose.valim@gmail.com> | 2010-01-14 19:53:07 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-01-15 12:24:30 +0100 |
commit | 8c8942ed4f2da52aa42ccd46560acb0b5fd37cb8 (patch) | |
tree | 976072122a45b4d050a0d6e798ae55ac3fea67a7 /activerecord | |
parent | 5a8e7287c542cbe82d3127cae83dab8571ab9114 (diff) | |
download | rails-8c8942ed4f2da52aa42ccd46560acb0b5fd37cb8.tar.gz rails-8c8942ed4f2da52aa42ccd46560acb0b5fd37cb8.tar.bz2 rails-8c8942ed4f2da52aa42ccd46560acb0b5fd37cb8.zip |
Move Dispatcher setup to Railties and add instrumentation hook.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/railtie.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/railtie.rb b/activerecord/lib/active_record/railtie.rb index 88d0aa624f..bc06333f1c 100644 --- a/activerecord/lib/active_record/railtie.rb +++ b/activerecord/lib/active_record/railtie.rb @@ -56,6 +56,19 @@ module ActiveRecord initializer "active_record.load_observers" do ActiveRecord::Base.instantiate_observers + + ActionDispatch::Callbacks.to_prepare(:activerecord_instantiate_observers) do + ActiveRecord::Base.instantiate_observers + end + end + + initializer "active_record.set_dispatch_hooks", :before => :set_clear_dependencies_hook do |app| + unless app.config.cache_classes + ActionDispatch::Callbacks.after do + ActiveRecord::Base.reset_subclasses + ActiveRecord::Base.clear_reloadable_connections! + end + end end # TODO: ActiveRecord::Base.logger should delegate to its own config.logger |