aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
authorSebi Burkhard <sebi.burkhard@gmail.com>2011-07-08 18:08:37 +0700
committerSebi Burkhard <sebi.burkhard@gmail.com>2011-07-08 18:08:37 +0700
commit9e63f9f2e42a3cbfd7b36e47ee5a7c94da757152 (patch)
treebd32bbda00d45bebf6d533ba1d96f9c8948fc7dd /activesupport/lib/active_support
parentad912c08a91b90f6a7b30ae75b4a3a5f6c513bd4 (diff)
downloadrails-9e63f9f2e42a3cbfd7b36e47ee5a7c94da757152.tar.gz
rails-9e63f9f2e42a3cbfd7b36e47ee5a7c94da757152.tar.bz2
rails-9e63f9f2e42a3cbfd7b36e47ee5a7c94da757152.zip
Properly cache value when it is "false"
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/cache.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb
index 85692428e3..ac88c82709 100644
--- a/activesupport/lib/active_support/cache.rb
+++ b/activesupport/lib/active_support/cache.rb
@@ -557,7 +557,7 @@ module ActiveSupport
@expires_in = options[:expires_in]
@expires_in = @expires_in.to_f if @expires_in
@created_at = Time.now.to_f
- if value
+ if defined?(value)
if should_compress?(value, options)
@value = Zlib::Deflate.deflate(Marshal.dump(value))
@compressed = true
@@ -576,7 +576,7 @@ module ActiveSupport
# Get the value stored in the cache.
def value
- if @value
+ if defined?(@value)
val = compressed? ? Marshal.load(Zlib::Inflate.inflate(@value)) : @value
unless val.frozen?
val.freeze rescue nil