We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 27b514a commit 9953d7aCopy full SHA for 9953d7a
lib/active_model/serializer/caching.rb
@@ -89,6 +89,10 @@ def fragmented(serializer)
89
# https://github.com/rails-api/active_model_serializers/pull/1249#issuecomment-146567837
90
def cache(options = {})
91
self._cache = ActiveModelSerializers.config.cache_store if ActiveModelSerializers.config.perform_caching
92
+ serializer = self
93
+ ActiveSupport.on_load(:action_controller) do
94
+ serializer._cache = ActiveModelSerializers.config.cache_store if ActiveModelSerializers.config.perform_caching
95
+ end
96
self._cache_key = options.delete(:key)
97
self._cache_only = options.delete(:only)
98
self._cache_except = options.delete(:except)
0 commit comments