From 3b378a7840c8c2a46935c73dc56d94d4b6fcee9e Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 3 Apr 2012 15:56:40 -0700 Subject: [PATCH] use File.binread to pull in the schema cache --- activerecord/lib/active_record/railtie.rb | 2 +- railties/lib/rails/application/configuration.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/activerecord/lib/active_record/railtie.rb b/activerecord/lib/active_record/railtie.rb index ee3a6bf8c0..e94b67cbdc 100644 --- a/activerecord/lib/active_record/railtie.rb +++ b/activerecord/lib/active_record/railtie.rb @@ -115,7 +115,7 @@ module ActiveRecord 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(open(filename, 'rb') { |f| f.read }) + cache = Marshal.load File.binread filename if cache.version == ActiveRecord::Migrator.current_version ActiveRecord::Base.connection.schema_cache = cache else diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb index 1cfcd30c5b..37297f0496 100644 --- a/railties/lib/rails/application/configuration.rb +++ b/railties/lib/rails/application/configuration.rb @@ -106,7 +106,7 @@ module Rails # YAML::load. def database_configuration require 'erb' - YAML::load(ERB.new(IO.read(paths["config/database"].first)).result) + YAML.load ERB.new(IO.read(paths["config/database"].first)).result end def log_level