I have an action that takes a while to complete. At the start, it should let the user know “please wait…” Then, when finished, it should tell them “finished.”
Currently the way I have it set up throws a double render error.
controller:
def do_work
render 'do_work.js'
.
. # takes a while...
.
.
redirect_to :action => :work_is_done
end
do_work.js.erb:
$("#status").text("please wait...");
What is the best way to do this?
Working in Rails 3 and jQuery.
Thanks.
You have to redirect from
do_work.js6000 – is time in miliseconds after which the function will be triggered
upd
ofc you will need a named route
work_is_donefor this to work.