Forum: Ruby on Rails Rails Order of Execution

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.
A0358eaa16fabf96e7d14119624b2ffb?d=identicon&s=25 Xeph (Guest)
on 2007-01-08 09:15
(Received via mailing list)

I have an RJS file that has scriptaculous page calls and system()
function calls. They're in the order of system(), scriptaculous,
system(), system(), scriptaculous. It seems that all the system()
functions get executed first, then the scriptaculous effects. Is there
anyway to have my code get executed in the original order? For example,
the first system call stops a recording, and first scriptaculous call
displays a "saving" <div> tag; the other two system() tag saves the
recording, and the final scriptaculous call displays a "recording
completed" <div> tag.

Any help is appreciated
3ddf2897026370c1b869159ba19124ec?d=identicon&s=25 Ian Leitch (Guest)
on 2007-01-08 12:49
(Received via mailing list)
The scriptaculous calls merely generate JavaScript that will eventually
sent to the client. Your RJS file is executed and rendered by the
all your system() calls will happen now, and the JavaScript required to
produce the effects on the frontend will have been generated -- _not_
executed. The generated code is then sent to the client (your browser)
it is then executed and you see the fancy effects.

You'll need to perform some ajax calls from the frontend that respond
RJS to trigger the system() calls on the server. You'll need one ajax
per system() call (unless you group them up) which will obviously take
a while with any more just a couple of remote calls. Not to mention that
you'll need to keep and eye out for clients that don't perform the full
number of requests that you'd expect.

My advice is to keep your design as simple as possible, it sounds like
you're going to end up with a lot of complex code just for the benefit
having effects fire in "real" time.
This topic is locked and can not be replied to.