Class: Faq::RefreshEmbeddingPosts

Inherits:
Object
  • Object
show all
Includes:
Service
Defined in:
app/services/faq/refresh_embedding_posts.rb

Overview

Refreshes posts that embed one or more FAQs and purges published post caches.

Both FAQ publishing and FAQ content updates use this workflow so embedded
FAQ markup and edge-cache invalidation stay consistent.

Defined Under Namespace

Classes: Result

Instance Method Summary collapse

Methods included from Service

#attributes_used, #build_result, call, #logger

Methods included from Service::Initializer

#initialize

Instance Method Details

#callResult

Refresh all posts that embed the supplied FAQs.

Returns:

  • (Result)

    per-post refresh and cache-purge outcomes



28
29
30
31
32
# File 'app/services/faq/refresh_embedding_posts.rb', line 28

def call
  return Result.new if post_ids.empty?

  Result.new(refreshed_posts: Post.where(id: post_ids).map { |post| refresh_post(post) })
end