From fd1e61adfc40275fe23fdcbc7796f7a72bf12fa3 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 19 May 2014 09:47:55 +0200 Subject: 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 --- lib/active_job/base.rb | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'lib/active_job/base.rb') 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 -- cgit v1.2.3