method
deserialize
v5.2.3 -
Show latest stable
- Class:
ActiveJob::Core
deserialize(job_data)public
Attaches the stored job data to the current instance. Receives a hash returned from serialize
Examples
class DeliverWebhookJob < ActiveJob::Base attr_writer :attempt_number def attempt_number @attempt_number ||= 0 end def serialize super.merge('attempt_number' => attempt_number + 1) end def deserialize(job_data) super self.attempt_number = job_data['attempt_number'] end rescue_from(Timeout::Error) do |exception| raise exception if attempt_number > 5 retry_job(wait: 10) end end