Skip to content

Commit

Permalink
[B] Correct text indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
zdavis committed Nov 27, 2023
1 parent a13a186 commit 3182a11
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/app/models/text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -366,12 +366,17 @@ def toc_entry_by_uid(uid)
# @api private
# @return [void]
def ensure_toc_uids!
return unless respond_to?(:toc)

toc.each(&:ensure_uid!)
end

# @api private
# @return [void]
def migrate_toc!
# When Sidekiq indexes, it doesn't necessarily query for all model attributes. In that
# case, we don't want this method to run.
return unless respond_to?(:toc)
return unless persisted?

ensure_toc_uids!
Expand Down

0 comments on commit 3182a11

Please sign in to comment.