1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Revert "Deprecate collection_cache_key which is private API"

This reverts commit f656bb301a.

Reason: Test in Action View expects the `collection_cache_key` working...

ff6b713f5e/actionview/test/activerecord/relation_cache_test.rb (L21)
ff6b713f5e/actionview/test/fixtures/project.rb (L6)

https://buildkite.com/rails/rails/builds/60609#d19181fb-fe80-4d1e-891c-1109b540fb4b/981-1009
This commit is contained in:
Ryuta Kamizono 2019-04-19 23:48:36 +09:00
parent 612af1926c
commit 69fcaaaf15
3 changed files with 2 additions and 6 deletions

View file

@ -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

View file

@ -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:

View file

@ -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