Providing updates during a long Rails controller action
Posted
by
highBandWidth
on Stack Overflow
See other posts from Stack Overflow
or by highBandWidth
Published on 2012-10-19T16:51:01Z
Indexed on
2012/10/19
17:00 UTC
Read the original article
Hit count: 153
ruby-on-rails
|mvc
I have an action that takes a long time. I want to be able to provide updates during the process so the user is not confused as to whether he lost the connection or something. Can I do something like this:
class HeavyLiftingController < ApplicationController
def data_mine
render_update :js=>"alert('Just starting!')"
# do some complicated find etc.
render_update :js=>"alert('Found the records!')"
# do some processing ...
render_update :js=>"alert('Done processig')"
# send @results to view
end
end
© Stack Overflow or respective owner