diff --git a/lib/delayed/worker.rb b/lib/delayed/worker.rb index 1a352f775..b4497649b 100644 --- a/lib/delayed/worker.rb +++ b/lib/delayed/worker.rb @@ -116,7 +116,7 @@ def self.setup_lifecycle end def self.reload_app? - defined?(ActionDispatch::Reloader) && Rails.application.config.cache_classes == false + defined?(ActionDispatch::Reloader) && defined?(Rails) && Rails.application.config.cache_classes == false end def self.delay_job?(job) @@ -326,7 +326,7 @@ def reserve_job def reload! return unless self.class.reload_app? - if defined?(ActiveSupport::Reloader) + if defined?(ActiveSupport::Reloader) && defined?(Rails) Rails.application.reloader.reload! else ActionDispatch::Reloader.cleanup!