diff options
author | Jon Leighton <j@jonathanleighton.com> | 2012-06-15 18:04:13 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2012-06-15 19:15:37 +0100 |
commit | ae3767c799708992f60442ab2e08b9108f01e5ed (patch) | |
tree | a24cbb8ca1735dd4b22b6ad3997ec761e249e9be /activerecord/lib/active_record/railtie.rb | |
parent | a205bf878084d74872fbad45fac030ad2cb74970 (diff) | |
download | rails-ae3767c799708992f60442ab2e08b9108f01e5ed.tar.gz rails-ae3767c799708992f60442ab2e08b9108f01e5ed.tar.bz2 rails-ae3767c799708992f60442ab2e08b9108f01e5ed.zip |
Fix observers with AR::Model
Diffstat (limited to 'activerecord/lib/active_record/railtie.rb')
-rw-r--r-- | activerecord/lib/active_record/railtie.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/railtie.rb b/activerecord/lib/active_record/railtie.rb index bcafcbb76c..9432a70c41 100644 --- a/activerecord/lib/active_record/railtie.rb +++ b/activerecord/lib/active_record/railtie.rb @@ -110,20 +110,21 @@ module ActiveRecord config.after_initialize do |app| ActiveSupport.on_load(:active_record) do - ActiveRecord::Base.instantiate_observers + ActiveRecord::Model.instantiate_observers ActionDispatch::Reloader.to_prepare do - ActiveRecord::Base.instantiate_observers + ActiveRecord::Model.instantiate_observers end end ActiveSupport.on_load(:active_record) do if app.config.use_schema_cache_dump filename = File.join(app.config.paths["db"].first, "schema_cache.dump") + if File.file?(filename) cache = Marshal.load File.binread filename if cache.version == ActiveRecord::Migrator.current_version - ActiveRecord::Base.connection.schema_cache = cache + ActiveRecord::Model.connection.schema_cache = cache else warn "schema_cache.dump is expired. Current version is #{ActiveRecord::Migrator.current_version}, but cache version is #{cache.version}." end |