-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pagination of a nested resource, without using active record #65
Comments
Update: In the end we found that solving it by a different method would require a lot of overriding of the JR methods, which was too much overhead so we simply manipulated the response before rendering, to display the correct link. |
Sorry for not answering in time, @guy-simplee. I went through hard days last week, but as soon as I get some free time, I'll check this issue in order to try taking some insights of improvement from it. |
@tiagopog I'd like to revisit this issue as I'm currently experiencing it while looking into using Request:
Response:
Note that the |
I think it's definitely worth revisiting it, @seanabrahams. Since I'm currently working on a few improvements for the gem I may come up with a solution for this issue soon. |
Bumping the tread, I was affected by that behavior too :/ How much work it would require to fix it on at gem side? Probably might help a bit. |
Looks like a daunting task, related issues from jsonapi-resources repo: |
Hi,
In our project, we are using JU for our API, currently only for get calls.
We have had some difficulties since we do not have direct access to our models in the API project, meaning we only have resources and controllers, and we are retrieving the data manually in the controller actions, into a hash which we then pass to jsonapi_format and render.
Specifically with pagination, what happens is the following:
We have some nested resources, with the routes declared this way:
So for our bills index route, we end up with the expected request url of "http://localhost:3005/accounts/2/bills" for example,
but the pagination links get generated with the following url, which doesn't exist in our routing:
"http://localhost:3005/bills?page%5Bnumber%5D=2&page%5Bsize%5D=1" (example for the "next" link)
If i manually add the account part to the request url, it seems like the paging functionality works as expected and I see the next page in the response.
My question is if there is any support for this scenario of pagination of a nested resource, or do I have no alternative but to manually alter the links section of the response and concatenate the missing part of the URL, which seems far from an ideal solution to me.
Not sure if this is a JU or JR issue, but any help would be much appreciated!
Thanks!
The text was updated successfully, but these errors were encountered: