Forum: Ruby on Rails loop action and view

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Nanyang Z. (Guest)
on 2007-04-20 01:40
I want to build a loop action, like:
>def loop_action
> @current_job = 0
> 100.each { |i| @current_job = i }

I want the view to display the @current_job information in realtime and
I'd like to have a stop button to stop the loop.

any idea to do this?
Richard L. (Guest)
on 2007-04-20 01:58
(Received via mailing list)
Maybe check out
 - Richard

On Apr 19, 2:40 pm, Nanyang Z. <removed_email_address@domain.invalid>
alexander (Guest)
on 2007-04-20 02:03
(Received via mailing list)
hi there,
you should look into the ajax/prototype helpers for this kind of
namely periodically_call_remote which lets your view call a remote
function that returns your @current_job
explained here:
and remote_function that would let you call a function that would stop
whatever it is that´s incrementing @current_job
explained here:

Nanyang Z. (Guest)
on 2007-04-20 02:27
Thank you for replying.
Richard, it's a nice plugin, maybe I'll use it some day. But it seems
too funtionful for my current simple app, and by the way, it needs

alexander wrote:
> you should look into periodically_call_remote remote_function
both of these function will call an action, how can I request an action
to act on another action?
Nanyang Z. (Guest)
on 2007-04-20 11:23
How about take the action directly into the view?
>for job in @jobs%
>#codes to display job and do other things...

if this works, a looooong page will be rendered, (Will it be rendered
when the loop ends or whenever a loop render a display content?)

and still, I have no idea how to stop the loops with a button.
This topic is locked and can not be replied to.