0
0
Fork 0

Unuse ActiveRecord::Base#cache_key (#8185)

* Unuse ActiveRecord::Base#cache_key

* Enable cache_versioning

* Call cache_collection
This commit is contained in:
abcang 2018-08-19 22:52:38 +09:00 committed by Eugen Rochko
parent 0d1d9b9a33
commit 9e75aa30cd
6 changed files with 9 additions and 17 deletions

View file

@ -17,8 +17,7 @@ class Api::V1::StatusesController < Api::BaseController
CONTEXT_LIMIT = 4_096
def show
cached = Rails.cache.read(@status.cache_key)
@status = cached unless cached.nil?
@status = cache_collection([@status], Status).first
render json: @status, serializer: REST::StatusSerializer
end