diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2016-12-13 11:59:45 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-13 11:59:45 -0500 |
commit | ddf81c5aa5cd29598e7fdd79842ed906c8de76e1 (patch) | |
tree | 4f6ee22b28b5e561229098f63f2d75ea3adbdd9f /activerecord/lib/active_record/railtie.rb | |
parent | 04dd8b7ac7ba82843de77ece3c96124c3b3dc365 (diff) | |
parent | 4c00c6ed230e6fdc6199dfba43f6da1e741a02aa (diff) | |
download | rails-ddf81c5aa5cd29598e7fdd79842ed906c8de76e1.tar.gz rails-ddf81c5aa5cd29598e7fdd79842ed906c8de76e1.tar.bz2 rails-ddf81c5aa5cd29598e7fdd79842ed906c8de76e1.zip |
Merge pull request #27042 from kirs/yaml-schema-cache
Schema cache in YAML
Diffstat (limited to 'activerecord/lib/active_record/railtie.rb')
-rw-r--r-- | activerecord/lib/active_record/railtie.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/railtie.rb b/activerecord/lib/active_record/railtie.rb index 7ce10df6d4..2701c5bca9 100644 --- a/activerecord/lib/active_record/railtie.rb +++ b/activerecord/lib/active_record/railtie.rb @@ -82,15 +82,15 @@ module ActiveRecord if config.active_record.delete(:use_schema_cache_dump) config.after_initialize do |app| ActiveSupport.on_load(:active_record) do - filename = File.join(app.config.paths["db"].first, "schema_cache.dump") + filename = File.join(app.config.paths["db"].first, "schema_cache.yml") if File.file?(filename) - cache = Marshal.load File.binread filename + cache = YAML.load(File.read(filename)) if cache.version == ActiveRecord::Migrator.current_version self.connection.schema_cache = cache self.connection_pool.schema_cache = cache.dup else - warn "Ignoring db/schema_cache.dump because it has expired. The current schema version is #{ActiveRecord::Migrator.current_version}, but the one in the cache is #{cache.version}." + warn "Ignoring db/schema_cache.yml because it has expired. The current schema version is #{ActiveRecord::Migrator.current_version}, but the one in the cache is #{cache.version}." end end end |