Is a way to output 'puts' or 'print'

I have a long running process for an internal Rails 3 app. In a certain case I iterate over and process thousands + records which takes awhile. I want to output something like the detail of which record is being processed out to the user, to show that the process is in progress and not hung. This app is not about not keeping the user from waiting but to keep them in the loop, excuse the pun.

So for example I have an array.each method which is handling these many records. Anyone have an idea how I could send messages out of this loop while it is in progress? If I was just writing a console app I would use ‘puts’ or ‘print’… so that I would see these messages in real time on the console. Any way to do anything similar on the web? I know on the ui side I would have to do some ajax in a loop to get the updates. Thinking aloud, I could have this method output to a db table which the ajax could query… kind of yucky.

Just curious if there would be any easy way to do this before I resort to a simple spinner.

Thanks,

David

You could log the output you wish to display. I think this would be
the best way if using a remote site.

But, if it's a local process and of limited use printing to the
console is ok. I wrote a rails program to track my local IP address as
it would change at random intervals and have the process print the
current IP out to a terminal.

David Kahn wrote in post #975899:

I have a long running process for an internal Rails 3 app. In a certain
case
I iterate over and process thousands + records which takes awhile. I
want to
output something like the detail of which record is being processed out
to
the user, to show that the process is in progress and not hung. This app
is
not about not keeping the user from waiting but to keep them in the
loop,
excuse the pun.

So for example I have an array.each method which is handling these many
records. Anyone have an idea how I could send messages out of this loop
while it is in progress? If I was just writing a console app I would use
'puts' or 'print'... so that I would see these messages in real time on
the
console. Any way to do anything similar on the web? I know on the ui
side I
would have to do some ajax in a loop to get the updates. Thinking aloud,
I
could have this method output to a db table which the ajax could
query...
kind of yucky.

Just curious if there would be any easy way to do this before I resort
to a
simple spinner.

A spinner would be easiest (because from the DOM perspective, it's
completely static!), but you could also use PeriodicUpdater or something
similar to write messages into the DOM.

Thanks,

David

Best,