diff options
author | José Valim <jose.valim@gmail.com> | 2010-04-20 13:44:49 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-04-20 21:19:48 +0200 |
commit | 2e3d903e1b54c1a37f29ed5168ee969d1ad9b55b (patch) | |
tree | 691733dbfd0a6e76ba78f0a3a32ad8cc37fca9db /activerecord | |
parent | 9934738ed5f05fe78cdf2c4cf5fcaae7227d5e1e (diff) | |
download | rails-2e3d903e1b54c1a37f29ed5168ee969d1ad9b55b.tar.gz rails-2e3d903e1b54c1a37f29ed5168ee969d1ad9b55b.tar.bz2 rails-2e3d903e1b54c1a37f29ed5168ee969d1ad9b55b.zip |
Move observers initialization to after_config blocks, they are still being initialized to early (before load paths are being set).
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/railtie.rb | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/activerecord/lib/active_record/railtie.rb b/activerecord/lib/active_record/railtie.rb index 878a4dac09..f3d21d4969 100644 --- a/activerecord/lib/active_record/railtie.rb +++ b/activerecord/lib/active_record/railtie.rb @@ -70,27 +70,23 @@ module ActiveRecord end end - initializer "active_record.add_observer_hook", :after=>"active_record.set_configs" do |app| + initializer "active_record.set_dispatch_hooks", :before => :set_clear_dependencies_hook do |app| ActiveSupport.on_load(:active_record) do - ActionDispatch::Callbacks.to_prepare(:activerecord_instantiate_observers) do - ActiveRecord::Base.instantiate_observers + unless app.config.cache_classes + ActionDispatch::Callbacks.after do + ActiveRecord::Base.reset_subclasses + ActiveRecord::Base.clear_reloadable_connections! + end end end end - initializer "active_record.instantiate_observers", :after=>"active_record.initialize_database" do + config.after_initialize do ActiveSupport.on_load(:active_record) do instantiate_observers - end - end - initializer "active_record.set_dispatch_hooks", :before => :set_clear_dependencies_hook do |app| - ActiveSupport.on_load(:active_record) do - unless app.config.cache_classes - ActionDispatch::Callbacks.after do - ActiveRecord::Base.reset_subclasses - ActiveRecord::Base.clear_reloadable_connections! - end + ActionDispatch::Callbacks.to_prepare(:activerecord_instantiate_observers) do + ActiveRecord::Base.instantiate_observers end end end |