Use continuation in rails

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?

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