Commit 28ceb3b4 authored by Michael Rose's avatar Michael Rose

search: elide result when pg is missing entry

This happens during local development, but with some logging it should
be easier to know if this ever happens in prod.
parent 2fe4d9b4
......@@ -154,7 +154,13 @@ class SearchResults
.includes([:author, :story_to_thread])
.joins([:author])
.index_by(&:id)
@results = story_ids.map { |id| stories_by_id[id] }
@results = story_ids
.map do |id|
story = stories_by_id[id]
if story.nil?
Rails.logger.warn "search: Couldn't find Story(#{id})"
end
story
end.compact
end
end
\ No newline at end of file
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