diff options
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | lib/active_job/queue_adapter.rb | 5 | ||||
-rw-r--r-- | test/adapters/delayed_job.rb | 4 |
3 files changed, 7 insertions, 6 deletions
@@ -5,7 +5,7 @@ of queueing backends. These jobs can be everything from regularly scheduled clean-ups, billing charges, or mailings. Anything that can be chopped up into small units of work and run in parallel, really. -It also serves as the backend for ActionMailer's #deliver_later functionality +It also serves as the backend for [ActionMailer's #deliver_later functionality](https://github.com/rails/activejob/issues/13) that makes it easy to turn any mailing into a job for running later. That's one of the most common jobs in a modern web application: Sending emails outside of the request-response cycle, so the user doesn't have to wait on it. @@ -41,7 +41,7 @@ That's it! ## GlobalID support -Active Job supports GlobalID serialization for parameters. This makes it possible +Active Job supports [GlobalID serialization](https://github.com/rails/activemodel-globalid/) for parameters. This makes it possible to pass live Active Record objects to your job instead of class/id pairs, which you then have to manually deserialize. Before, jobs would look like this: diff --git a/lib/active_job/queue_adapter.rb b/lib/active_job/queue_adapter.rb index a1987a7dc3..2033f6fe56 100644 --- a/lib/active_job/queue_adapter.rb +++ b/lib/active_job/queue_adapter.rb @@ -6,12 +6,13 @@ module ActiveJob mattr_reader(:queue_adapter) { ActiveJob::QueueAdapters::InlineAdapter } def queue_adapter=(name_or_adapter) - if name_or_adapter.is_a?(Symbol) || name_or_adapter.is_a?(String) + case name_or_adapter + when Symbol, String adapter = load_adapter(name_or_adapter) else adapter = name_or_adapter end - + @@queue_adapter = adapter end diff --git a/test/adapters/delayed_job.rb b/test/adapters/delayed_job.rb index c5d9fd37ab..afd9c9deb7 100644 --- a/test/adapters/delayed_job.rb +++ b/test/adapters/delayed_job.rb @@ -1,7 +1,7 @@ -require 'delayed_job' +ActiveJob::Base.queue_adapter = :delayed_job + $LOAD_PATH << File.dirname(__FILE__) + "/../support/delayed_job" Delayed::Worker.delay_jobs = false Delayed::Worker.backend = :test -ActiveJob::Base.queue_adapter = :delayed_job |