Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
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
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
Please sign in to comment.
Something went wrong with that request. Please try again.