-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
In 2.4 I was able to pass a pagination cursor to client, which would get serialized to JSON format using result[:after] and then I had to use a bit more manual process to convert the same JSON object back to a pagination cursor:
json_array.map {|element|
if element.respond_to?('key?') && element.key?('@ref')
Fauna::Query.method(:ref).call(element['@ref'])
else
element
end
}Now, in 3.0 it seems like that conversion process no longer works and it results with invalid expression - Ref expected, Object provided error.
As a workaround, I managed to get it to work with:
json_array.map {|element|
if element.respond_to?('key?') && element.key?('@ref')
Fauna::Query::ref(Fauna::Query::class_(element['@ref']['class']['@ref']['id']), element['@ref']['id'])
else
element
end
}But that requires updating the old code that worked just fine, so it looks like a regression.
Also, is there an easier/more recommended way to convert a pagination cursor to/from JSON?
Metadata
Metadata
Assignees
Labels
No labels