Permalink
Browse files

fixed #5845

  • Loading branch information...
1 parent efa9a1f commit 048efe7fdcd6b26293066f6cc61ec05d377ff88c angelo giovanni capilleri committed Apr 15, 2012
Showing with 3 additions and 3 deletions.
  1. +2 −2 activerecord/lib/active_record/integration.rb
  2. +1 −1 activerecord/test/cases/base_test.rb
@@ -33,13 +33,13 @@ def to_param
#
# Product.new.cache_key # => "products/new"
# Product.find(5).cache_key # => "products/5" (updated_at not available)
- # Person.find(5).cache_key # => "people/5-20071224150000" (updated_at available)
+ # Person.find(5).cache_key # => "people/5-1334398193-832774" (updated_at available)
def cache_key
case
when new_record?
"#{self.class.model_name.cache_key}/new"
when timestamp = self[:updated_at]
- timestamp = timestamp.utc.to_s(:number)
+ timestamp = timestamp.utc.to_f.gsub(/\./,'-')
"#{self.class.model_name.cache_key}/#{id}-#{timestamp}"
else
"#{self.class.model_name.cache_key}/#{id}"
@@ -2113,7 +2113,7 @@ def test_cache_key_for_existing_record_is_not_timezone_dependent
def test_cache_key_format_for_existing_record_with_updated_at
dev = Developer.first
- assert_equal "developers/#{dev.id}-#{dev.updated_at.utc.to_s(:number)}", dev.cache_key
+ assert_equal "developers/#{dev.id}-#{dev.updated_at.utc.to_f.gsub(/\./,'-')}", dev.cache_key
end
def test_cache_key_format_for_existing_record_with_nil_updated_at

0 comments on commit 048efe7

Please sign in to comment.