Skip to content

Instantly share code, notes, and snippets.

@mileszs
Created April 20, 2010 21:14
Show Gist options
  • Select an option

  • Save mileszs/373083 to your computer and use it in GitHub Desktop.

Select an option

Save mileszs/373083 to your computer and use it in GitHub Desktop.
task :cron => :environment do
return false if CronJob.last.created_at.today?
CronJob.create(:name => "Daily Cron #{Time.now}")
ActivityScan.affect.take_action!
time = Time.local(Time.now.year, Time.now.month, Time.now.day, rand(3) + 12, rand(60))
User.send_at(time, :ask_all_a_random_anonymous_question)
CronJob.update_attributes(:completed_at => Time.now)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment