aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2019-04-19 23:48:36 +0900
committerRyuta Kamizono <kamipo@gmail.com>2019-04-19 23:54:25 +0900
commit69fcaaaf15880dc20b9ec19a9b839f375a64a1d2 (patch)
tree3e0fc4a3cfa2b28335cd7d9c66f960826fa4656e
parent612af1926c4501cf66dd1d8ea5b923bb80cf4bb1 (diff)
downloadrails-69fcaaaf15880dc20b9ec19a9b839f375a64a1d2.tar.gz
rails-69fcaaaf15880dc20b9ec19a9b839f375a64a1d2.tar.bz2
rails-69fcaaaf15880dc20b9ec19a9b839f375a64a1d2.zip
Revert "Deprecate `collection_cache_key` which is private API"
This reverts commit f656bb301a43fe441af0039e4fafe40a7faa62f8. Reason: Test in Action View expects the `collection_cache_key` working... https://github.com/rails/rails/blob/ff6b713f5e729859995f204093ad3f8e08f39ea8/actionview/test/activerecord/relation_cache_test.rb#L21 https://github.com/rails/rails/blob/ff6b713f5e729859995f204093ad3f8e08f39ea8/actionview/test/fixtures/project.rb#L6 https://buildkite.com/rails/rails/builds/60609#d19181fb-fe80-4d1e-891c-1109b540fb4b/981-1009
-rw-r--r--activerecord/lib/active_record/integration.rb2
-rw-r--r--activerecord/lib/active_record/relation.rb2
-rw-r--r--activerecord/test/cases/collection_cache_key_test.rb4
3 files changed, 2 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/integration.rb b/activerecord/lib/active_record/integration.rb
index 810b6884f1..573a823dbc 100644
--- a/activerecord/lib/active_record/integration.rb
+++ b/activerecord/lib/active_record/integration.rb
@@ -1,7 +1,6 @@
# frozen_string_literal: true
require "active_support/core_ext/string/filters"
-require "active_support/deprecation"
module ActiveRecord
module Integration
@@ -165,7 +164,6 @@ module ActiveRecord
def collection_cache_key(collection = all, timestamp_column = :updated_at) # :nodoc:
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 b3a1b69293..ab24f67a6d 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] ||= compute_cache_key(timestamp_column)
+ @cache_keys[timestamp_column] ||= klass.collection_cache_key(self, timestamp_column)
end
def compute_cache_key(timestamp_column = :updated_at) # :nodoc:
diff --git a/activerecord/test/cases/collection_cache_key_test.rb b/activerecord/test/cases/collection_cache_key_test.rb
index f01bc0d7f1..f07f3c42e6 100644
--- a/activerecord/test/cases/collection_cache_key_test.rb
+++ b/activerecord/test/cases/collection_cache_key_test.rb
@@ -13,9 +13,7 @@ module ActiveRecord
fixtures :developers, :projects, :developers_projects, :topics, :comments, :posts
test "collection_cache_key on model" do
- assert_deprecated do
- assert_match(/\Adevelopers\/query-(\h+)-(\d+)-(\d+)\z/, Developer.collection_cache_key)
- end
+ assert_match(/\Adevelopers\/query-(\h+)-(\d+)-(\d+)\z/, Developer.collection_cache_key)
end
test "cache_key for relation" do