Thanks ... I am looking at the http://railscasts.com/episodes/229-polling-for-changes
this is quite obvious ( because it's async..) ... only the client page can request periodic updates ... On 10 mar, 15:28, Walter Lee Davis <wa...@wdstudio.com> wrote: > On Mar 10, 2011, at 8:18 AM, Erwin wrote: > > > > > > > > > > > I trying to update multi times a page from inside a loop, obviously > > the loop cannot be outside the update block > > > as a test I wrote : > > > def reloading > > @tables = ["table_lockers", "table_instructors", "table_members", > > "table_analyses"] > > render :update do |page| > > @tables.each do |table| > > page.insert_html :bottom, 'table_list', "<li > > id='#{table}'>#{table}</li>" > > page.visual_effect :highlight, "#{table}" > > sleep 3 > > end > > end > > end > > > upon click on a start link remote Ajax call to the reloading action, > > this intend > > to insert the names of the tables one by one into a list area on the > > displayed page... with 3 sec between each insertion : > > > <ul>table_list > > table_lockers > > table_instructors > > table_members > > table_analyses > > > this doesn't work as expected as the render id performed at the end of > > the loop.... not in between > > This isn't going to work if you do it in Ruby. That's one request, > which equals one render and one flush to the browser. You're going to > have to refactor this so that the timer is in the JavaScript, and each > request is for the next table. You'll have to work out some sort of > semaphore between the ruby code (which knows how many of these things > to do) and the JavaScript, which does not. One way would be to have > the ruby code write an inline JavaScript block into the table code > when it knows there are more to come, and omit it if not. > > Walter -- 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@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.