lib/resque/tasks.rb in mongo-resque-1.18.2 vs lib/resque/tasks.rb in mongo-resque-1.19.0

- old
+ new

@@ -39,13 +39,16 @@ threads.each { |thread| thread.join } end # Preload app files if this is Rails - task :preload do - if defined? Rails - Dir["#{Rails.root}/app/**/*.rb"].each do |file| - require file - end + task :preload => :setup do + if defined?(Rails) && Rails.respond_to?(:application) + # Rails 3 + Rails.application.eager_load! + elsif defined?(Rails::Initializer) + # Rails 2.3 + $rails_rake_task = false + Rails::Initializer.run :load_application_classes end end end