Class: NewspaperWorks::CreateIssuePagesJob
- Inherits:
-
ApplicationJob
- Object
- ActiveJob::Base
- ApplicationJob
- NewspaperWorks::CreateIssuePagesJob
- Defined in:
- app/jobs/newspaper_works/create_issue_pages_job.rb
Overview
Create child page works for issue
Instance Method Summary collapse
Instance Method Details
#perform(work, pdf_paths, user, admin_set_id) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/jobs/newspaper_works/create_issue_pages_job.rb', line 4 def perform(work, pdf_paths, user, admin_set_id) # we will need depositor set on work, if it is nil work.depositor ||= user # if we do not have admin_set_id yet, set it on the issue work: work.admin_set_id ||= admin_set_id # create child pages for each page within each PDF uploaded: pdf_paths.each do |path| adapter = NewspaperWorks::Ingest::NewspaperIssueIngest.new(work) adapter.load(path) adapter.create_child_pages end # re-save pages so that parent and sibling relationships are indexed work.pages.each(&:save) end |