instance method
deserialize
Ruby on Rails 5.1.7
Since v5.0.7.2Signature
deserialize(job_data)
Attaches the stored job data to the current instance. Receives a hash returned from serialize
Examples
class DeliverWebhookJob < ActiveJob::Base
def serialize
super.merge('attempt_number' => (@attempt_number || 0) + 1)
end
def deserialize(job_data)
super
@attempt_number = job_data['attempt_number']
end
rescue_from(TimeoutError) do |exception|
raise exception if @attempt_number > 5
retry_job(wait: 10)
end
end
Parameters
-
job_datareq
Source
# File activejob/lib/active_job/core.rb, line 112
def deserialize(job_data)
self.job_id = job_data["job_id"]
self.provider_job_id = job_data["provider_job_id"]
self.queue_name = job_data["queue_name"]
self.priority = job_data["priority"]
self.serialized_arguments = job_data["arguments"]
self.executions = job_data["executions"]
self.locale = job_data["locale"] || I18n.locale.to_s
end
Defined in activejob/lib/active_job/core.rb line 112
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveJob::Core