title: Ruby rails - ajax periodical update
body: <p>I am trying to get a list of recent items every 5 seconds. The list has to be rendered on every view under that controller. What is a best approach to get it done in rails3? Something like  a ticker. Any got a great solution/example for this? </p>
  
  <p>So I am trying these three javascripts I found on discussion forums. and none of them generating any requests to the server. Any idea why? </p>
  
  <pre><code>$(document).ready(
    function(){
      setInterval(function(){
        $('#item_list').load('/item/item_list');
      }, 3000);
    });
  
  $(document).ready(function worker() {
    $.ajax({
      url: '/item/item_list',
      success: function(data) {
        $('#item_list').html(data);
      },
      complete: function() {
        setTimeout(worker, 500);
      }
  })();
  
  function startTimer()
  {
     new Ajax.PeriodicalUpdater('#item_list', '/item/item_list', {
       method: 'get', frequency: 3, decay: 2
     });
  }();
  $(document).ready(startTimer(););
  </code></pre>