# Use continuation in rails

**URL:** <https://www.ruby-forum.com/t/use-continuation-in-rails/112494>\
**Category:** Rails\
**Created:** [August 20, 2007, 8:14am UTC](https://www.ruby-forum.com/t/use-continuation-in-rails/112494 "2007-08-20T08:14:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jack\_archer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/3e96dc/32.png) [@jack\_archer](https://www.ruby-forum.com/u/jack_archer)\
**Post date:** [August 20, 2007, 8:14am UTC](https://www.ruby-forum.com/t/use-continuation-in-rails/112494/1 "2007-08-20T08:14:33Z")

</div>

Hello  
anyone with some experience to use continuation across different http  
request?  
I try to implement a web service method like below:

def getallnotes(userid)  
$contHash = Hash.new unless $contHash  
$contHash[userid].call if $contHash[userid]  
curr\_idx = 0  
while curr\_idx \< @notes.size  
callcc {|continuation|  
$contHash[userid] = continuation  
return @notes[curr\_idx, 5]  
}  
curr\_idx += 5  
end  
$contHash.delete(userid)  
nil  
end

The idea is that if the @notes is too big, return all the data once may  
not be a good idea. So each time I just return 5 data. then use  
continuation to store the context. Then if same user call this method  
again, it will jump to the point of last execution to return the next 5  
data.  
But I got the error:  
“continuation called across threads”

Is it possible to use continuation in rails that way?
