Load data works in terminal but in json api it returns empty
Inside this code i am trying to load all versions of a record for example, it works in my terminal and
paper_trail_versions
has some records as a list but in api json call the paper_trail_versions
is []
empty
Thank you in advance6 Replies
loaded data is not automatically shown in the response
on the route those fields should be included with
fields[type]=whatever
and then the logic you're doing here should be in a calculation
that can be loadedi am doing like this
paper_trail_versions
is a relationship in this case
so it should be includedSolution
But you'd add a calculation like
sorted_versions
or somethingthat returns
:struct
with constraints instance_of: Version
or version_history
etc.i will try with calculation, but i just wanted to know can i do something like my code , it did not work whole day :))
Thank you for the fast response ♥️
i think calculation supports pagination from Version