diff --git a/lib/jsonapi/renderer/cached_resources_processor.rb b/lib/jsonapi/renderer/cached_resources_processor.rb index de42cb9..2e77f7d 100644 --- a/lib/jsonapi/renderer/cached_resources_processor.rb +++ b/lib/jsonapi/renderer/cached_resources_processor.rb @@ -4,12 +4,6 @@ module JSONAPI class Renderer # @private class CachedResourcesProcessor < ResourcesProcessor - class JSONString < String - def to_json(*) - self - end - end - def initialize(cache) @cache = cache end @@ -19,9 +13,7 @@ def process_resources cache_hash = cache_key_map(resources) processed_resources = @cache.fetch_multi(*cache_hash.keys) do |key| res, include, fields = cache_hash[key] - json = res.as_jsonapi(include: include, fields: fields).to_json - - JSONString.new(json) + res.as_jsonapi(include: include, fields: fields) end resources.replace(processed_resources.values) diff --git a/spec/caching_spec.rb b/spec/caching_spec.rb index 35c605c..9de4c94 100644 --- a/spec/caching_spec.rb +++ b/spec/caching_spec.rb @@ -96,6 +96,6 @@ def fetch_multi(*keys) } expect(JSON.parse(actual.to_json)).to eq(JSON.parse(expected.to_json)) - expect(actual[:data]).to be_a(JSONAPI::Renderer::CachedResourcesProcessor::JSONString) + expect(actual[:data]).to be_a(Hash) end end