aboutsummaryrefslogtreecommitdiffstats
path: root/lib/active_job/base.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2014-05-19 09:47:55 +0200
committerDavid Heinemeier Hansson <david@loudthinking.com>2014-05-19 10:15:19 +0200
commitfd1e61adfc40275fe23fdcbc7796f7a72bf12fa3 (patch)
tree28363f61366d31ca8a434ec8ef30c1389ee36516 /lib/active_job/base.rb
parentd7c30987ff83e1ab02f3ba981f5c0027e674583f (diff)
downloadrails-fd1e61adfc40275fe23fdcbc7796f7a72bf12fa3.tar.gz
rails-fd1e61adfc40275fe23fdcbc7796f7a72bf12fa3.tar.bz2
rails-fd1e61adfc40275fe23fdcbc7796f7a72bf12fa3.zip
Dont need the explicit error handling -- if the require fails, it will raise exactly the error we want to communicate anyway. Also use the load path, so we can allow plugins, rather than requre_relative
Diffstat (limited to 'lib/active_job/base.rb')
-rw-r--r--lib/active_job/base.rb16
1 files changed, 2 insertions, 14 deletions
diff --git a/lib/active_job/base.rb b/lib/active_job/base.rb
index f39dba6f5f..86008d3c94 100644
--- a/lib/active_job/base.rb
+++ b/lib/active_job/base.rb
@@ -1,9 +1,7 @@
-require 'active_job/errors'
require 'active_job/queue_adapters/inline_adapter'
require 'active_support/core_ext/string/inflections'
module ActiveJob
-
class Base
cattr_accessor(:queue_adapter) { ActiveJob::QueueAdapters::InlineAdapter }
cattr_accessor(:queue_base_name) { "active_jobs" }
@@ -19,19 +17,9 @@ module ActiveJob
end
def adapter=(adapter_name)
- adapter_name = adapter_name.to_s
- unless %w(inline resque sidekiq sucker_punch).include?(adapter_name)
- fail ActiveJob::NotImplementedError
- end
-
- begin
- require_relative "queue_adapters/#{adapter_name}_adapter"
- ActiveJob::Base.queue_adapter = "ActiveJob::QueueAdapters::#{adapter_name.camelize}Adapter".constantize
- rescue
- fail ActiveJob::Error.new("#{adapter_name} is missing")
- end
+ require "active_job/queue_adapters/#{adapter_name}_adapter"
+ ActiveJob::Base.queue_adapter = "ActiveJob::QueueAdapters::#{adapter_name.to_s.camelize}Adapter".constantize
end
end
-
end
end \ No newline at end of file