From aeb431a6ca7cd05f8d29f454a24bf8f5bd5423ae Mon Sep 17 00:00:00 2001 From: Robin Dupret Date: Fri, 31 Oct 2014 19:46:43 +0100 Subject: [PATCH] Tiny documentation improvements [ci skip] --- activejob/lib/active_job/core.rb | 7 ++----- activejob/lib/active_job/enqueuing.rb | 3 ++- guides/source/active_job_basics.md | 9 ++++----- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/activejob/lib/active_job/core.rb b/activejob/lib/active_job/core.rb index f55db5a588..68d46e6466 100644 --- a/activejob/lib/active_job/core.rb +++ b/activejob/lib/active_job/core.rb @@ -48,8 +48,8 @@ def set(options={}) end end - # Creates a new job instance. Takes as arguments the arguments that - # will be passed to the perform method. + # Creates a new job instance. Takes the arguments that will be + # passed to the perform method. def initialize(*arguments) @arguments = arguments @job_id = SecureRandom.uuid @@ -84,6 +84,3 @@ def deserialize_arguments(serialized_args) end end end - - - diff --git a/activejob/lib/active_job/enqueuing.rb b/activejob/lib/active_job/enqueuing.rb index cca0a2a8d6..53d944021a 100644 --- a/activejob/lib/active_job/enqueuing.rb +++ b/activejob/lib/active_job/enqueuing.rb @@ -22,7 +22,7 @@ def job_or_instantiate(*args) end end - # Reschedule the job to be re-executed. This is useful in combination + # Reschedules the job to be re-executed. This is useful in combination # with the +rescue_from+ option. When you rescue an exception from your job # you can ask Active Job to retry performing your job. # @@ -37,6 +37,7 @@ def job_or_instantiate(*args) # rescue_from(ErrorLoadingSite) do # retry_job queue: :low_priority # end + # # def perform(*args) # # raise ErrorLoadingSite if cannot scrape # end diff --git a/guides/source/active_job_basics.md b/guides/source/active_job_basics.md index 875919e237..de69ab3211 100644 --- a/guides/source/active_job_basics.md +++ b/guides/source/active_job_basics.md @@ -172,15 +172,15 @@ end # environment ``` -If you want more control on what queue a job will be run you can pass a :queue -option to #set: +If you want more control on what queue a job will be run you can pass a `:queue` +option to `#set`: ```ruby MyJob.set(queue: :another_queue).perform_later(record) ``` -To control the queue from the job level you can pass a block to queue_as. The -block will be executed in the job context (so you can access self.arguments) +To control the queue from the job level you can pass a block to `#queue_as`. The +block will be executed in the job context (so you can access `self.arguments`) and you must return the queue name: ```ruby @@ -202,7 +202,6 @@ end ProcessVideoJob.perform_later(Video.last) ``` - NOTE: Make sure your queueing backend "listens" on your queue name. For some backends you need to specify the queues to listen to. -- GitLab