# AJAXy Timeline (e.g. election.twitter.com)

**URL:** <https://www.ruby-forum.com/t/ajaxy-timeline-e-g-election-twitter-com/151707>\
**Category:** Rails\
**Created:** [October 24, 2008, 5:46pm UTC](https://www.ruby-forum.com/t/ajaxy-timeline-e-g-election-twitter-com/151707 "2008-10-24T17:46:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Donnie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ee59a6/32.png) [@Donnie](https://www.ruby-forum.com/u/Donnie)\
**Post date:** [October 24, 2008, 5:46pm UTC](https://www.ruby-forum.com/t/ajaxy-timeline-e-g-election-twitter-com/151707/1 "2008-10-24T17:46:45Z")

</div>

I’m using the Prototype helper “periodically\_call\_remote” to add a new  
item to a list similar to how [http://election.twitter.com](http://election.twitter.com) works.

My question is, how do I make it so that periodically\_call\_remote will  
only add items that it hasn’t already added? The remote action is  
querying the database for new records, but it pulls all records that  
have been created since the page was originally loaded not the last  
time the periodically\_call\_remote fired. So, it adds the same new  
items every time it is called.

I have a few ideas about how to make this work, but none of them seem  
ideal. I’m sure this is a pretty common problem, and someone has  
already solved this.

Any ideas? Links? Suggestions?

TIA,

Donnie

---

<div class="post-metadata">

**Author:** ![Donnie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ee59a6/32.png) [@Donnie](https://www.ruby-forum.com/u/Donnie)\
**Post date:** [October 24, 2008, 6:20pm UTC](https://www.ruby-forum.com/t/ajaxy-timeline-e-g-election-twitter-com/151707/2 "2008-10-24T18:20:51Z")

</div>

On Fri, Oct 24, 2008 at 8:45 AM, Donnie [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> My question is, how do I make it so that periodically\_call\_remote will  
> only add items that it hasn’t already added? The remote action is  
> querying the database for new records, but it pulls all records that  
> have been created since the page was originally loaded not the last  
> time the periodically\_call\_remote fired.

How does the action know when the page in question was loaded?

Sounds like there’s a parameter being passed to define “more recent  
than X”, and that needs to be updated. Just a WAG 🙂

## FWIW,

Hassan S. ------------------------ removed\_email\_address@domain.invalid
