Permalink
Browse files

Modified the init script to load the jobs from the app/jobs directory…

… in a rails application. Much better to keep them there instead of in the lib directory.
  • Loading branch information...
1 parent 5988b5b commit 967902714f04502240735b89aab92a58422b8c52 @PatrickTulskie committed Jul 28, 2009
Showing with 8 additions and 0 deletions.
  1. +8 −0 init.rb
View
8 init.rb
@@ -1,2 +1,10 @@
+# Load the main delayed_job file
require File.dirname(__FILE__) + '/lib/delayed_job'
+
+# Default config data
Delayed::Job.destroy_successful_jobs = false
+
+# Load all of the jobs from the app/jobs directory if this is a rails application.
+if defined?(RAILS_ROOT) && File.exists?("#{RAILS_ROOT}/app/jobs")
+ Dir.glob("#{RAILS_ROOT}/app/jobs/*").each { |job| require job }
+end

0 comments on commit 9679027

Please sign in to comment.