T
Tony Targonski
I am trying to get Rails to loop though a number of functions within a
controller, rendering the status in the process. A simplified version
would be something like
class TestController < ApplicationController
def index
redirect_to :action => 'foo', :id => 2
end
def foo
if @params["id"].to_i > 0 then
redirect_to :action => 'foo', :id => @params["id"].to_i
- 1
end
end
end
Where the template for 'foo' is something as simple as
<%= @params["id"] %>
<% sleep 1 %>
In theory this should go through
foo/2
foo/1
foo/0
displaying each, but that is not the case. Although sleep function is
executed during each unique ID, no renders take place until the loop has
gone down to 0.
Can anyone think of a workaround for this problem? I have a loop to be
executed and want to let the user know how far in the program is. Also
(more importantly) prevent FastCGI from timing out during this
indefinitely long procedure.
Thank you,
--Tony
controller, rendering the status in the process. A simplified version
would be something like
class TestController < ApplicationController
def index
redirect_to :action => 'foo', :id => 2
end
def foo
if @params["id"].to_i > 0 then
redirect_to :action => 'foo', :id => @params["id"].to_i
- 1
end
end
end
Where the template for 'foo' is something as simple as
<%= @params["id"] %>
<% sleep 1 %>
In theory this should go through
foo/2
foo/1
foo/0
displaying each, but that is not the case. Although sleep function is
executed during each unique ID, no renders take place until the loop has
gone down to 0.
Can anyone think of a workaround for this problem? I have a loop to be
executed and want to let the user know how far in the program is. Also
(more importantly) prevent FastCGI from timing out during this
indefinitely long procedure.
Thank you,
--Tony