diff --git a/lib/jsonapi/renderer/cached_resources_processor.rb b/lib/jsonapi/renderer/cached_resources_processor.rb index 080ee99..de42cb9 100644 --- a/lib/jsonapi/renderer/cached_resources_processor.rb +++ b/lib/jsonapi/renderer/cached_resources_processor.rb @@ -17,7 +17,7 @@ def initialize(cache) def process_resources [@primary, @included].each do |resources| cache_hash = cache_key_map(resources) - processed_resources = @cache.fetch_multi(cache_hash.keys) do |key| + 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 diff --git a/spec/caching_spec.rb b/spec/caching_spec.rb index f153ba7..35c605c 100644 --- a/spec/caching_spec.rb +++ b/spec/caching_spec.rb @@ -5,7 +5,7 @@ def initialize @cache = {} end - def fetch_multi(keys) + def fetch_multi(*keys) keys.each_with_object({}) do |k, h| @cache[k] = yield(k) unless @cache.key?(k) h[k] = @cache[k]