This is for http://github.com/tobi/delayed_job
the example says:
script/generate delayed_job_migration
if I run it
$ script/generate delayed_job_migration
Couldn't find 'delayed_job_migration' generator
On github, there is a generators
folder, an init.rb
, a lib
folder, and a tasks
folder, where should they go into our project? (using Rails 3.0)
It also says add code like this:
class NewsletterJob < Struct.new(:text, :emails)
def perform
emails.each { |e| NewsletterMailer.deliver_text_to_email(text, e) }
end
end
Delayed::Job.enqueue NewsletterJob.new('lorem ipsum...', Customers.find(:all).collect(&:email))
but where should this code go? to the controller or in a lib file? and how do you invoke it? I suppose the enqueue
code need to only run once really?