diff options
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/railtie.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/railtie.rb b/activerecord/lib/active_record/railtie.rb index 04c4a9c153..878a4dac09 100644 --- a/activerecord/lib/active_record/railtie.rb +++ b/activerecord/lib/active_record/railtie.rb @@ -70,9 +70,7 @@ module ActiveRecord end end - initializer "active_record.load_observers" do - ActiveSupport.on_load(:active_record) { instantiate_observers } - + initializer "active_record.add_observer_hook", :after=>"active_record.set_configs" do |app| ActiveSupport.on_load(:active_record) do ActionDispatch::Callbacks.to_prepare(:activerecord_instantiate_observers) do ActiveRecord::Base.instantiate_observers @@ -80,6 +78,12 @@ module ActiveRecord end end + initializer "active_record.instantiate_observers", :after=>"active_record.initialize_database" 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 |