aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/lib
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-12-05 16:32:42 +0900
committerGitHub <noreply@github.com>2017-12-05 16:32:42 +0900
commit0f8568f58d36a543f9eb423171f42731784b34af (patch)
treeea04c612c55eaf38c02f14cdd24eca4af07b47ea /activejob/lib
parent3c442b6df91e291ebbf17f37444414bf5f10fbe6 (diff)
parent649f19cab1d4dd805c915912ede29c86655084cd (diff)
downloadrails-0f8568f58d36a543f9eb423171f42731784b34af.tar.gz
rails-0f8568f58d36a543f9eb423171f42731784b34af.tar.bz2
rails-0f8568f58d36a543f9eb423171f42731784b34af.zip
Merge pull request #31334 from yhirano55/fix_example_code_in_active_job
Fix example code in ActiveJob::Core [ci skip]
Diffstat (limited to 'activejob/lib')
-rw-r--r--activejob/lib/active_job/core.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/activejob/lib/active_job/core.rb b/activejob/lib/active_job/core.rb
index c4e12fc518..879746fc01 100644
--- a/activejob/lib/active_job/core.rb
+++ b/activejob/lib/active_job/core.rb
@@ -97,17 +97,23 @@ module ActiveJob
# ==== Examples
#
# class DeliverWebhookJob < ActiveJob::Base
+ # attr_writer :attempt_number
+ #
+ # def attempt_number
+ # @attempt_number ||= 0
+ # end
+ #
# def serialize
- # super.merge('attempt_number' => (@attempt_number || 0) + 1)
+ # super.merge('attempt_number' => attempt_number + 1)
# end
#
# def deserialize(job_data)
# super
- # @attempt_number = job_data['attempt_number']
+ # self.attempt_number = job_data['attempt_number']
# end
#
- # rescue_from(TimeoutError) do |exception|
- # raise exception if @attempt_number > 5
+ # rescue_from(Timeout::Error) do |exception|
+ # raise exception if attempt_number > 5
# retry_job(wait: 10)
# end
# end