Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The most typical way of handling this is to use a cron job. You schedule a job to run every 15 minutes or so and deliver any reminders that come up in that time. Unfortunately, heroku only allows cron jobs to run every hour, which usually isn't often enough. </p> <p>In this case, I'd use delayedjob and trick it into setting up a recurring task that delivers the notifications as often as necessary. For example, you could create a function that begins by rescheduling itself to run in 10 minutes and then goes on to send any reminders that popped up in the previous 10 minutes. </p> <p>To view delayedjobs send_at syntax to schedule future jobs check here: <a href="http://wiki.github.com/tobi/delayed_job/" rel="nofollow noreferrer">http://wiki.github.com/tobi/delayed_job/</a></p> <p>ADDED after comments: To send the reminder, you would need to create a function that searches for pending reminders and sends them. For example, let's say you have a model called Reminder (rails 3 syntax cause I like it better):</p> <pre><code>def self.find_and_send_reminders reminders = Reminder.where("send_at &lt; ? AND sent = ?", Time.now, false).all reminders.each do |r| #the following delayed_job syntax is apparently new, and I haven't tried it. came from the collective_idea fork of delayed_job on github Notifier.delay.deliver_reminder_email(r) #I'm not checking to make sure that anything actually sent successfully here, just assuming they did. may want to address this better in your real app r.update_attributes!(:sent =&gt; true) end #again using the new syntax, untested. heroku may require the old "send_at" and "send_later" syntax Reminder.delay(:run_at =&gt; 15.minutes.from_now).find_and_send_reminders end </code></pre> <p>This syntax assumes you decided to use the single reminder entry for every occurence method. If you decide to use a single entry for all recurring reminders, you could create a field like "last_sent" instead of a boolean for "sent" and use that. Keep in mind these are all just ideas, I haven't actually taken the time to implement anything like this yet so I probably haven't considered all the options/problems. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload