I've got a daily cron, added to an app with a free plan, that I would
like to send out daily summaries to users who made changes to their
profiles. I'm too new to rails and Heroku alike to figure out if the
cron job is not running or if I've just written a crummy rake task.

I can send the emails from the heroku console just fine, running
heroku addons assures me that I have a daily cron added, and logs:cron
gives me zilch.

My rake task looks like this:
task :cron => :environment do
  if Time.now.hour == 0 # run at midnight
    puts "Sending out daily summaries.."
    User.first.daily_summary            (at first I was trying
User.daily_summary to no avail)
  end
end

The actual method looks about like this:

def daily_summary
  yesterday =  (Time.now - (60*60*24))
  @users = User.all(:conditions => ["last_request_at >?", yesterday])
  @users.each do |u|
    if u.profile.updated?
      print profile.name
      Notifier.deliver_daily_summary_letter(u, profile)
    end
  end
end

I was stuck on this for a while, abandoned it, and came back a few
days later with not much better of an idea, so, durn. Any ideas on how
to fix this or on how to squeeze more out of them logs would be much
appreciated.

thanks,
andrew

-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.

Reply via email to