Skip to content

Instantly share code, notes, and snippets.

@gertig
Created February 6, 2011 01:44
Show Gist options
  • Save gertig/813017 to your computer and use it in GitHub Desktop.
Save gertig/813017 to your computer and use it in GitHub Desktop.
Rails 3 demo of using HTTParty and Moment for delayed jobs
#models/person.rb
class Person < ActiveRecord::Base
def self.create_schedule
@people = Person.find(:all)
time_increment = 1 #Starts the first scheduled task for 1 minute from now.
@people.each do |person|
schedule = Scheduler.new(person.id, time_increment)
pp schedule.schedule_it
time_increment = time_increment + 1
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment