Skip to content


Subversion checkout URL

You can clone with
Download ZIP
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...
commit 967902714f04502240735b89aab92a58422b8c52 1 parent 5988b5b
@PatrickTulskie authored
Showing with 8 additions and 0 deletions.
  1. +8 −0 init.rb
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 }
Please sign in to comment.
Something went wrong with that request. Please try again.