# Problem in Getting Records one by one

**URL:** <https://www.ruby-forum.com/t/problem-in-getting-records-one-by-one/175174>\
**Category:** Rails\
**Created:** [September 9, 2009, 9:55am UTC](https://www.ruby-forum.com/t/problem-in-getting-records-one-by-one/175174 "2009-09-09T09:55:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [September 9, 2009, 9:55am UTC](https://www.ruby-forum.com/t/problem-in-getting-records-one-by-one/175174/1 "2009-09-09T09:55:54Z")

</div>

Hi All,

Here is the code I am using

\<%= periodically\_call\_remote :update =\> “news\_div”, :url =\> { :action =\>  
“get\_news”}, :frequency =\> “5” %\>

this is my method get\_news

def get\_news  
@news = News.find(:all, :conditions =\> [“status =\> ?”, “Active”],  
:order  
=\> “created\_at DESC”, :limit =\> 5)  
end

/views

\<% for news in @news %\>  
\<%= news.title %\>  
\<% end %\>

I want results to be displayed one by one not all at a time. What to do?  
I  
am stuck here, please help.

–  
Thanks and Regards

* * *

Puneet Pandey  
Ruby on Rails Developer

> **[PUNEET PANDEY's WEBLOG](https://puneetitengineer.wordpress.com/)**
>
> Where perfection meets intelligence

In Puneet’s Lab: [http://www.puneetpandey.com](http://www.puneetpandey.com)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [September 9, 2009, 10:28am UTC](https://www.ruby-forum.com/t/problem-in-getting-records-one-by-one/175174/2 "2009-09-09T10:28:05Z")

</div>

I don’t know the correct solution. But you are fetching 5 records,  
therefore, it will display all of them. You can use javascript effects  
to  
generate some effects or fetch 1 record at a time.

BTW, hope you know that some new items may not be displayed if rate of  
generation of new news items is more than the limit in your find  
condition  
(ie, 5)

## Thanks, Abhinav

à¤…à¤­à¤¿à¤¨à¤µ  
[http://twitter.com/abhinav](http://twitter.com/abhinav)
