Skip to content

Instantly share code, notes, and snippets.

@kossnocorp
Created December 14, 2009 04:41
Show Gist options
  • Select an option

  • Save kossnocorp/255773 to your computer and use it in GitHub Desktop.

Select an option

Save kossnocorp/255773 to your computer and use it in GitHub Desktop.
script/generate delayed_job && rake db:migrate
script/delayed_job start
namespace :cron do
task :start => :environment do
TestCronTask.cron_it!
end
end
...
Rails::Initializer.run do |config|
...
config.gem 'delayed_job'
...
end
class TestCronTask < ActiveRecord::Base
class << self
def cron_it!
Delayed::Job.enqueue(TestCron.new, 0, 1.minutes.from_now)
end
def create_point!
create!
cron_it!
end
end
end
class TestCronTask < ActiveRecord::Base
class << self
def cron_it!
Delayed::Job.enqueue(TestCron.new, 0, 1.minutes.from_now)
end
def create_point!
create!
cron_it!
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment