Loop action and view

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?

Maybe check out http://juggernaut.rubyforge.org/

  • Richard

On Apr 19, 2:40 pm, Nanyang Z. [email protected]

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:


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?

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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs