File tree Expand file tree Collapse file tree 2 files changed +6
-11
lines changed
active_model_serializers/adapter Expand file tree Collapse file tree 2 files changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -206,15 +206,6 @@ def object_cache_key(serializer, adapter_instance)
206206 end
207207 end
208208
209- # Get attributes from @cached_attributes
210- # @return [Hash] cached attributes
211- # def cached_attributes(fields, adapter_instance)
212- def cached_fields ( fields , adapter_instance )
213- cache_check ( adapter_instance ) do
214- attributes ( fields )
215- end
216- end
217-
218209 def cache_check ( adapter_instance )
219210 if self . class . cache_enabled?
220211 self . class . cache_store . fetch ( cache_key ( adapter_instance ) , self . class . _cache_options ) do
Original file line number Diff line number Diff line change @@ -37,10 +37,14 @@ def serializable_hash_for_single_resource(options)
3737 cached_attributes = instance_options [ :cached_attributes ] || { }
3838 key = serializer . cache_key ( self )
3939 cached_attributes . fetch ( key ) do
40- serializer . cached_fields ( options [ :fields ] , self )
40+ serializer . cache_check ( self ) do
41+ serializer . attributes ( options [ :fields ] )
42+ end
4143 end
4244 else
43- serializer . cached_fields ( options [ :fields ] , self )
45+ serializer . cache_check ( self ) do
46+ serializer . attributes ( options [ :fields ] )
47+ end
4448 end
4549 relationships = resource_relationships ( options )
4650 resource . merge ( relationships )
You can’t perform that action at this time.
0 commit comments