aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@basecamp.com>2014-06-12 12:11:36 +0200
committerDavid Heinemeier Hansson <david@basecamp.com>2014-06-12 12:11:36 +0200
commit4eae97a5cf3954ff1422de08a1120f7b205be9ba (patch)
tree46c394a6b0835e81e33a7452ee3c469c29916b51 /lib
parent62c5ea58aa17e649235241a94b162c0059239983 (diff)
parentda6a86f875199cf28872d9db06efb5c6908ee457 (diff)
downloadrails-4eae97a5cf3954ff1422de08a1120f7b205be9ba.tar.gz
rails-4eae97a5cf3954ff1422de08a1120f7b205be9ba.tar.bz2
rails-4eae97a5cf3954ff1422de08a1120f7b205be9ba.zip
Merge pull request #85 from DouweM/queue_name
Have .queue_as only set queue name for job in question.
Diffstat (limited to 'lib')
-rw-r--r--lib/active_job/base.rb2
-rw-r--r--lib/active_job/queue_name.rb16
2 files changed, 13 insertions, 5 deletions
diff --git a/lib/active_job/base.rb b/lib/active_job/base.rb
index 0c772e3126..d5ba253016 100644
--- a/lib/active_job/base.rb
+++ b/lib/active_job/base.rb
@@ -9,8 +9,8 @@ require 'active_job/logging'
module ActiveJob
class Base
extend QueueAdapter
- extend QueueName
+ include QueueName
include Enqueuing
include Execution
include Callbacks
diff --git a/lib/active_job/queue_name.rb b/lib/active_job/queue_name.rb
index a606b67370..859ddad034 100644
--- a/lib/active_job/queue_name.rb
+++ b/lib/active_job/queue_name.rb
@@ -1,10 +1,18 @@
module ActiveJob
module QueueName
- mattr_accessor(:queue_base_name) { "active_jobs" }
- mattr_accessor(:queue_name) { queue_base_name }
+ extend ActiveSupport::Concern
- def queue_as(part_name)
- self.queue_name = "#{queue_base_name}_#{part_name}"
+ module ClassMethods
+ mattr_accessor(:queue_base_name) { "active_jobs" }
+
+ def queue_as(part_name)
+ self.queue_name = "#{queue_base_name}_#{part_name}"
+ end
+ end
+
+ included do
+ class_attribute :queue_name
+ self.queue_name = queue_base_name
end
end
end \ No newline at end of file