Created
October 5, 2009 19:46
-
-
Save seamusabshere/202376 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FriendsController | |
def index | |
@friends = @user.friends | |
@friends_of_friends = slow { @user.friends_of_friends } | |
end | |
def import | |
@result = slow { @user.friends.import(params[:big_csv]) } | |
end | |
end | |
# (app/views/friends/index.html.erb) | |
# Your friends are <%= @friends %> | |
# The friends of your friends are <%= friends_of_friends %> | |
# (app/views/friends/import.html.erb) | |
# You imported <%= @result %> | |
# implementation idea | |
# @result = slow { sleep(900); "hello" } would return like a SlowString | |
# t0: <%= @result %> => <span class="processing" id="slow_string_020d92ojaodisjdad">processing...</span> | |
# t1: <%= @result %> => ditto | |
# ... | |
# t900: <%= @result %> => <span class="done" id="slow_string_020d92ojaodisjdad">hello</span> | |
# | |
# and there would be baked-in javascript that observed these slow strings until AJAX calls | |
# on them returned 200 or smth |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment