Skip to content

Commit 4185614

Browse files
author
Katrina Owen
committed
Tweak check for schema cache serialization strategy
This checks for the inclusion of .dump rather than ending with dump for the schema cache filename, in order to switch between Marshal (.dump) and YAML (default). This is so that we can wrap gzipping around both strategies cleanly.
1 parent d4a536d commit 4185614

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

activerecord/lib/active_record/connection_adapters/schema_cache.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def self.load_from(filename)
99
return unless File.file?(filename)
1010

1111
file = File.read(filename)
12-
filename.end_with?(".dump") ? Marshal.load(file) : YAML.load(file)
12+
filename.include?(".dump") ? Marshal.load(file) : YAML.load(file)
1313
end
1414

1515
attr_reader :version
@@ -144,7 +144,7 @@ def dump_to(filename)
144144
clear!
145145
connection.data_sources.each { |table| add(table) }
146146
File.atomic_write(filename) { |f|
147-
if filename.end_with?(".dump")
147+
if filename.include?(".dump")
148148
f.write(Marshal.dump(self))
149149
else
150150
f.write(YAML.dump(self))

0 commit comments

Comments
 (0)