Class: WebflowSync::InitialSyncJob

Inherits:
ApplicationJob
  • Object
show all
Defined in:
app/jobs/webflow_sync/initial_sync_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(collection_slug) ⇒ Object



5
6
7
8
9
10
11
12
# File 'app/jobs/webflow_sync/initial_sync_job.rb', line 5

def perform(collection_slug)
  model_class = collection_slug.underscore.classify.constantize
  model_class.where(webflow_item_id: nil).find_each do |record|
    next if record.should_skip_webflow_sync?

    client(record.webflow_site_id).create_item(collection_id: record.webflow_collection_id, record:)
  end
end