Class: Course::ObjectDuplicationJob

Inherits:
ApplicationJob show all
Includes:
TrackableJob
Defined in:
app/jobs/course/object_duplication_job.rb

Instance Attribute Summary

Attributes included from TrackableJob

#job

Instance Method Summary collapse

Methods included from TrackableJob

#initialize, #job_id=, #perform, #rescue_tracked, #wait

Instance Method Details

#perform_tracked(source_course, destination_course, objects, options = {}) ⇒ Object (protected)

Performs the object duplication job.

Parameters:

  • source_course (Course)

    Course to duplicate from.

  • destination_course (Course)

    Course to duplicate to.

  • objects (Object|Array)

    The object(s) to duplicate.

  • options (Hash) (defaults to: {})

    The options to be sent to the Duplicator object.


15
16
17
18
19
20
21
22
# File 'app/jobs/course/object_duplication_job.rb', line 15

def perform_tracked(source_course, destination_course, objects, options = {})
  ActsAsTenant.without_tenant do
    Course::Duplication::ObjectDuplicationService.duplicate_objects(
      source_course, destination_course, objects, options
    )
    redirect_to course_url(options[:destination_course], host: destination_course.instance.host)
  end
end