I’m having a bit of a hard time with the function
periodically_call_remote. Here is my problem:
I have a periodically_call_remote in a partial. With ajax, I do a
replace_html of this partial for another partial, view/edit type of
thing. The 2nd partial doesn’t contain a periodically_call_remote.
The problem is that the browser CONTINUES to query the server even tho
the periodically_call_remote shouldn’t be there anymore, because the
partial changed.
Does anyone know how to disable this behavior? Can I call something in
my .rjs templates to disable/enablethe periodically_call_remote?
And in the controller to handle the update and turn off the periodic
call:
def update_results
render :update do |page|
page[‘periodic’].replace_html :partial => ‘results_table’
page.assign ‘stop_polling’, true #<< here is the magick!
end
end
I hate replying to myself, but I just noticed somethign else. When I
come back from my partial that does not have a periodically_call_remote
to the one that has, the browser now queries the server TWICE. Once
for the original periodically_call_remote, and once for everytime the
partial is reloaded.
This is not good…
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.