Method: ActiveJob::Callbacks::ClassMethods#after_perform

Defined in:
activejob/lib/active_job/callbacks.rb

#after_perform(*filters, &blk) ⇒ Object

Defines a callback that will get called right after the job’s perform method has finished.

class VideoProcessJob < ActiveJob::Base
  queue_as :default

  after_perform do |job|
    UserMailer.notify_video_processed(job.arguments.first)
  end

  def perform(video_id)
    Video.find(video_id).process
  end
end


84
85
86
# File 'activejob/lib/active_job/callbacks.rb', line 84

def after_perform(*filters, &blk)
  set_callback(:perform, :after, *filters, &blk)
end