1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
class TerraformJob < Que::Job def run(mini_environment_id) ActiveRecord::Base.transaction do @mini_environment = MiniEnvironment.find(mini_environment_id) run_terraform end end def destroy FinishedTerraformJob.create( mini_environment_id: @mini_environment.id, job_class: attrs[:job_class] ) super end end