Method: ActiveJob::Callbacks::ClassMethods#before_perform
- Defined in:
- activejob/lib/active_job/callbacks.rb
#before_perform(*filters, &blk) ⇒ Object
Defines a callback that will get called right before the job’s perform method is executed.
class VideoProcessJob < ActiveJob::Base
queue_as :default
before_perform do |job|
UserMailer.notify_video_started_processing(job.arguments.first)
end
def perform(video_id)
Video.find(video_id).process
end
end
65 66 67 |
# File 'activejob/lib/active_job/callbacks.rb', line 65 def before_perform(*filters, &blk) set_callback(:perform, :before, *filters, &blk) end |