lib/active_support/cache.rb in activesupport-3.2.0.rc1 vs lib/active_support/cache.rb in activesupport-3.2.0.rc2

- old
+ new

@@ -576,10 +576,20 @@ def value # If the original value was exactly false @value is still true because # it is marshalled and eventually compressed. Both operations yield # strings. if @value - Marshal.load(compressed? ? Zlib::Inflate.inflate(@value) : @value) + # In rails 3.1 and earlier values in entries did not marshaled without + # options[:compress] and if it's Numeric. + # But after commit a263f377978fc07515b42808ebc1f7894fafaa3a + # all values in entries are marshalled. And after that code below expects + # that all values in entries will be marshaled (and will be strings). + # So here we need a check for old ones. + begin + Marshal.load(compressed? ? Zlib::Inflate.inflate(@value) : @value) + rescue TypeError + compressed? ? Zlib::Inflate.inflate(@value) : @value + end end end def compressed? @compressed