Monday, September 13, 2010

Ruby on Rails: Update page multiple times in controller

Programmer Question

So I have a rather long controller function that performs various tasks, and it takes around 10-15 seconds. I want to be able to update the user on the status of the function as it goes along (progress bar). Ideally, the function is called as an Ajax request, and would then update the page as it goes along. This would work except you can only update the page once per action. Any ideas? Thank you.



This is what I want to do in code:



def long_function
updatePage "Starting long_function"
#some code which take 5 seconds"
updatePage "Finished with first part"
#some more code which takes a while
updatePage "Finished second part"
#last code part
updatePage "Finished!"
end


Find the answer here

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails