Use continuation in rails

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

def getallnotes(userid)
$contHash = 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

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
But I got the error:
“continuation called across threads”

Is it possible to use continuation in rails that way?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs