instance method
before_perform
Ruby on Rails 7.0.10
Since v4.2.9Signature
before_perform(*filters, &blk)
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
Parameters
-
filtersrest -
blkblock
Source
# File activejob/lib/active_job/callbacks.rb, line 56
def before_perform(*filters, &blk)
set_callback(:perform, :before, *filters, &blk)
end
Defined in activejob/lib/active_job/callbacks.rb line 56
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveJob::Callbacks::ClassMethods