aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorPrathamesh Sonpatki <csonpatki@gmail.com>2016-09-07 23:01:11 +0530
committerPrathamesh Sonpatki <csonpatki@gmail.com>2016-09-07 23:11:56 +0530
commitbd60e54021eee93a50d020b11cc42e92cdff4d4b (patch)
treef72606df68674285eed7e7a519e1f3c7f4a2591d /activerecord/test/cases
parent71f37ce4893f63da49e4854db945a8ccb0ae3f5c (diff)
downloadrails-bd60e54021eee93a50d020b11cc42e92cdff4d4b.tar.gz
rails-bd60e54021eee93a50d020b11cc42e92cdff4d4b.tar.bz2
rails-bd60e54021eee93a50d020b11cc42e92cdff4d4b.zip
Fix issue with `cache_key` when the named timestamp column has value nil
- When the named timestamp column is nil, we should just return the cache_key with model name and id similar to the behavior of implicit timestamp columns. - Fixed one of the issue mentioned in https://github.com/rails/rails/issues/26417.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/integration_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/integration_test.rb b/activerecord/test/cases/integration_test.rb
index 766917b196..00457965d7 100644
--- a/activerecord/test/cases/integration_test.rb
+++ b/activerecord/test/cases/integration_test.rb
@@ -172,4 +172,10 @@ class IntegrationTest < ActiveRecord::TestCase
owner = owners(:blackbeard)
assert_equal "owners/#{owner.id}-#{owner.happy_at.utc.to_s(:usec)}", owner.cache_key(:updated_at, :happy_at)
end
+
+ def test_cache_key_when_named_timestamp_is_nil
+ owner = owners(:blackbeard)
+ owner.happy_at = nil
+ assert_equal "owners/#{owner.id}", owner.cache_key(:happy_at)
+ end
end