Commit 338d9b25 authored by Douwe Maan's avatar Douwe Maan

Don't return nil for missing objects from parser cache

parent 5771b946
---
title: Don't return nil for missing objects from parser cache
merge_request:
author:
...@@ -171,7 +171,7 @@ module Banzai ...@@ -171,7 +171,7 @@ module Banzai
collection.where(id: to_query).each { |row| cache[row.id] = row } collection.where(id: to_query).each { |row| cache[row.id] = row }
end end
cache.values_at(*ids) cache.values_at(*ids).compact
else else
collection.where(id: ids) collection.where(id: ids)
end end
......
...@@ -114,7 +114,7 @@ describe Banzai::ReferenceParser::BaseParser, lib: true do ...@@ -114,7 +114,7 @@ describe Banzai::ReferenceParser::BaseParser, lib: true do
expect(hash).to eq({ link => user }) expect(hash).to eq({ link => user })
end end
it 'returns an empty Hash when entry does not exist in the database' do it 'returns an empty Hash when entry does not exist in the database', :request_store do
link = double(:link) link = double(:link)
expect(link).to receive(:has_attribute?). expect(link).to receive(:has_attribute?).
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment