aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2019-04-19 23:01:24 +0900
committerRyuta Kamizono <kamipo@gmail.com>2019-04-19 23:10:53 +0900
commitf656bb301a43fe441af0039e4fafe40a7faa62f8 (patch)
treeabdaeb1f903ae9330b46844a537bf2c211d922c2 /activerecord/lib/active_record
parent10da0a27512e108a5cde3eeba774b01c15f6c43a (diff)
downloadrails-f656bb301a43fe441af0039e4fafe40a7faa62f8.tar.gz
rails-f656bb301a43fe441af0039e4fafe40a7faa62f8.tar.bz2
rails-f656bb301a43fe441af0039e4fafe40a7faa62f8.zip
Deprecate `collection_cache_key` which is private API
The `collection_cache_key` is private API for a long time, but I've maintained it in #35848 since it is mentioned in the doc (https://github.com/rails/rails/pull/35848#discussion_r272011475). The doc has removed at 1da9a7e4, so there is no longer a reason to maintain that private API.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/integration.rb4
-rw-r--r--activerecord/lib/active_record/relation.rb4
2 files changed, 6 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/integration.rb b/activerecord/lib/active_record/integration.rb
index c745bc1330..810b6884f1 100644
--- a/activerecord/lib/active_record/integration.rb
+++ b/activerecord/lib/active_record/integration.rb
@@ -1,6 +1,7 @@
# frozen_string_literal: true
require "active_support/core_ext/string/filters"
+require "active_support/deprecation"
module ActiveRecord
module Integration
@@ -162,8 +163,9 @@ module ActiveRecord
end
def collection_cache_key(collection = all, timestamp_column = :updated_at) # :nodoc:
- collection.compute_cache_key(timestamp_column)
+ collection.send(:compute_cache_key, timestamp_column)
end
+ deprecate :collection_cache_key
end
private
diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb
index 8eb71e6454..b3a1b69293 100644
--- a/activerecord/lib/active_record/relation.rb
+++ b/activerecord/lib/active_record/relation.rb
@@ -310,7 +310,7 @@ module ActiveRecord
# Product.where("name like ?", "%Game%").cache_key(:last_reviewed_at)
def cache_key(timestamp_column = :updated_at)
@cache_keys ||= {}
- @cache_keys[timestamp_column] ||= @klass.collection_cache_key(self, timestamp_column)
+ @cache_keys[timestamp_column] ||= compute_cache_key(timestamp_column)
end
def compute_cache_key(timestamp_column = :updated_at) # :nodoc:
@@ -323,6 +323,7 @@ module ActiveRecord
"#{key}-#{compute_cache_version(timestamp_column)}"
end
end
+ private :compute_cache_key
# Returns a cache version that can be used together with the cache key to form
# a recyclable caching scheme. The cache version is built with the number of records
@@ -382,6 +383,7 @@ module ActiveRecord
"#{size}"
end
end
+ private :compute_cache_version
# Scope all queries to the current scope.
#