Created
December 14, 2009 04:41
-
-
Save kossnocorp/255773 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| script/generate delayed_job && rake db:migrate | |
| script/delayed_job start |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace :cron do | |
| task :start => :environment do | |
| TestCronTask.cron_it! | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ... | |
| Rails::Initializer.run do |config| | |
| ... | |
| config.gem 'delayed_job' | |
| ... | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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