Files
assistant-storefront/app/jobs/migration/conversation_batch_cache_label_job.rb

15 lines
578 B
Ruby
Raw Permalink Normal View History

class Migration::ConversationBatchCacheLabelJob < ApplicationJob
queue_as :async_database_migration
# To cache the label, we simply access it from the object and save it. Anytime the object is
# saved in the future, ActsAsTaggable will automatically recompute it. This process is done
# initially when the user has not performed any action.
# Reference: https://github.com/mbleigh/acts-as-taggable-on/wiki/Caching
def perform(conversation_batch)
conversation_batch.each do |conversation|
conversation.label_list
conversation.save!
end
end
end