# Creating a News Ticker

**URL:** <https://www.ruby-forum.com/t/creating-a-news-ticker/108195>\
**Category:** Rails\
**Created:** [June 29, 2007, 10:29pm UTC](https://www.ruby-forum.com/t/creating-a-news-ticker/108195 "2007-06-29T22:29:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![partydrone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a6a055/32.png) [@partydrone](https://www.ruby-forum.com/u/partydrone)\
**Post date:** [June 29, 2007, 10:29pm UTC](https://www.ruby-forum.com/t/creating-a-news-ticker/108195/1 "2007-06-29T22:29:21Z")

</div>

I want to create a news ticker. I pull the top five articles from the  
database in my controller and pass it on to my view. I have a ticker  
bar, and I want to cycle through each article continuously. I  
previously did this with custom javascript from an RSS feed.

Any ideas?

Thanks.

---

<div class="post-metadata">

**Author:** ![partydrone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a6a055/32.png) [@partydrone](https://www.ruby-forum.com/u/partydrone)\
**Post date:** [June 29, 2007, 10:35pm UTC](https://www.ruby-forum.com/t/creating-a-news-ticker/108195/2 "2007-06-29T22:35:22Z")

</div>

It’s expensive, but periodically\_call\_remote will issue an Ajax call  
to your server at a specified interval and you can then update a div  
containing your news blip.

---

<div class="post-metadata">

**Author:** ![partydrone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a6a055/32.png) [@partydrone](https://www.ruby-forum.com/u/partydrone)\
**Post date:** [June 29, 2007, 11:00pm UTC](https://www.ruby-forum.com/t/creating-a-news-ticker/108195/3 "2007-06-29T23:00:24Z")

</div>

I’m familiar with the commands, it’s implementing them that’s causing  
me headaches. When I try using

\<%= periodically\_call\_remote(:update =\> ‘ticker\_headline’, :frequency  
=\> 3, :url =\> { :partial =\> ‘article’, :collection =\> @articles }) %\>

in or outside of my tag, it loads the entire home page over again and  
puts it inside. NOT the article title I want…

What about passing the @articles collection to cycle? Anyway to use  
that with JavaScript to accomplish the same thing without the expense  
of periodically\_call\_remote?

---

<div class="post-metadata">

**Author:** ![partydrone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a6a055/32.png) [@partydrone](https://www.ruby-forum.com/u/partydrone)\
**Post date:** [June 30, 2007, 1:37am UTC](https://www.ruby-forum.com/t/creating-a-news-ticker/108195/4 "2007-06-30T01:37:38Z")

</div>

Are you rendering with

:layout =\> false

in your callback function?

On Jun 29, 2007, at 1:59 PM, partydrone wrote:

> What about passing the @articles collection to cycle? Anyway to use
> 
> > 
> 
> >

Steve R.  
removed\_email\_address@domain.invalid  
[http://www.calicowebdev.com](http://www.calicowebdev.com)

---

<div class="post-metadata">

**Author:** ![partydrone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a6a055/32.png) [@partydrone](https://www.ruby-forum.com/u/partydrone)\
**Post date:** [July 27, 2007, 11:15pm UTC](https://www.ruby-forum.com/t/creating-a-news-ticker/108195/5 "2007-07-27T23:15:59Z")

</div>

What about using custom JavaScript and passing the articles  
(@articles) to that JavaScript from the controller?
