-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Links generation should be optional when using json-api adapter with kaminari or will_paginate. #1549
Comments
@youroff Hi! Thanks for writing! You're right that it's not documented. I just took a look at the code ant it looks like you can: class NonPaginatedCollectionSerializer < ActiveModel::Serializer::CollectionSerializer
def paginated?
false
end
end
ActiveModelSerializers.config.collection_serializer = NonPaginatedCollectionSerializer ref:
Also, we've recently added issue templates and I haven't seen anyone using them. Are they perhaps not showing up? |
That will work, but I think that global config would be better (probably, something like autopaginate: true), unless it's mandatory part of the response declared by json-api. Yeah, I've noticed that, sorry. I thought as long as it wasn't an issue precisely (no trace, etc), I could write as is. Next will use it. Just ran into another problem, again not sure if that's a bug or feature. So when decalred an association |
I have this same problem, I am making Rails + Ember integration, and I don't use this links. I support a global option |
It's not mandatory, but having a pagination plugin makes it a good assumption you want to paginate... I'd accept a PR to disable it, with |
Please create a new issue so we can discuss there. |
Can we consider this resolved? |
Thank you, for me this is not resolved until we make a PR, I want to do it, but I have some stuff(work) to do right now, maybe I can do this later. |
@victor95pc Awesome. That gives me some room to work on getting more prs and issues resolved (when I'm not working :). |
@bf4 not sure if using of pagination implies the need of links. I just use meta to pass total_pages and increment page when needed in the client app. Besides that ember-data generates urls on its own, not even sure if there's a way to pass link explicitly there. |
So, your use case is that you're using the JSON API adapter and a paginated resource, but your client prefers pagination links to be in |
@bf4 I would say that ember-data json-api adapter doesn't use links at all. Or at least I didn't hear about it. Yeah, option would work for me, but I see that many people would use the same pair of rails and ember and they simply wouldn't need links out of the box too. |
I agree that the best option here is to provide a configuration. I ran into the same issue and using a special serializer for that felt counter intuitive to me. @victor95pc did you already start working on a PR here? I would like to start with one if it's not the case. |
@groyoh You probably will make it more fast than me, I am kind of busy, Ember and Rails are killing me LoL. |
It will honor links for async relationships FWIW, and I believe it is on the roadmap to use links for pagination - unclear if it will be links or meta, depends on the implementation.
AFAIK the current ember way is to use
Yup - I think the JSONAPI links work for something like a command-line client, or maybe infinite scrolling, but not your standard Ember/Angular/etc app. |
@richmolj Yeah pagination can live in multiple places, top level
|
ref: mharris717/ember-cli-pagination#144 and cc @jfelchner |
The links just automatically showed up with one of recent updates. Correct me if I'm wrong, but I haven't found how to turn them off right away. Shouldn't it be optional?
The text was updated successfully, but these errors were encountered: