Open Ivanov-Anton opened 1 year ago
In the 0.9 version of the gem, the sorting on relationships _only works for belongs_to
relationships_. I believe this is the actual bug here.
@johnnymo87 Yeah correct. I'll try to improve this method to fix this in release-0-9 branch
As a workaround I plucked the ids from the query results and generated another query like this Model.where(id: ids)
by so, sorting is possible since there are no relations etc. and it works even I don't like how it performs
This issue is a (choose one):
Checklist before submitting:
Description
When making a request to a specific API endpoint with the query parameter sort=country.name, the application crashes due to an error in the sorting mechanism. The problem arises because the country relationship does not directly belong to the destination model but rather through another association. This leads to an undefined column error when attempting to perform the sorting operation.
Additional info
jsonapi-resource version 0.9.12