title: How do you write a Rails cron job Whenever gem?
body: <p>The <strong>whenever</strong> gem is installed. I see all kinds of cron and <strong>whenever</strong> tutorials about scheduling tasks with minutes, hours, days etc. I watched the railscast video on cron/<strong>whenever</strong>.
  But I've yet to find any examples about how to write a job itself, other than rake tasks.</p>
  
  <p>I want to schedule a task that checks the database for changes. The idea is that the database will have tags that tell you which particular row has changed. <strong>Whenever</strong> should poll the database periodically to check for these changes. Then it hopefully can push, or let the client know it needs to update the page dynamically using ajax.
  If I were doing this manually, I'd use commands like:</p>
  
  <pre><code> rails dbconsole
   select blah from blah;
  </code></pre>
  
  <p>Is there a way to write mysql commands in <strong>whenever</strong>? Is this the correct/best way to poll the database for changes?
  I know there are ways to poll a database from mysql itself, but I've been specifically told to do it from the rails side.</p>
  
  <p>I'm a newbie to all of these technologies (Rails, databases, ajax) so that's probably why the answer isn't clear to me.</p>
  
  <p>On the client end, I have buttons that use jquery to add/delete/change row data, just to assure myself I know how to change things in the table once I can get stuff from the database. Those buttons will eventually be removed. </p>
  
  <p>Right now, the page uses ajax to refresh the entire html table. But they would like just a row refresh/update through ajax.</p>