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 received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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. On Jan 18, 7:23 pm, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote:> 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 received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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, > > DavidBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.