Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Adding will_paginate support for total_entries being passed in as an option #81

Conversation

magnusfiorepalm
Copy link
Contributor

Summary

ApiPagination#paginate takes options. These options are then part of paginating the collection using the WillPaginate::Collection#paginate method. Only page and per_page used to be passed through all the way down to the will_paginate method. This PR makes sure that we simply pass through all options passed in.

This specifically adds support for a total_entries size different from the size of the collection.

…option

* In order to support a total_entries size different from the size of the collection
we will need to pass the options all the way down to the WillPaginate::Collection#paginate method.
@magnusfiorepalm
Copy link
Contributor Author

@davidcelis Let me know if there's any additional information you'd like me to provide.

@davidcelis
Copy link
Owner

Sorry for the wait! Thanks ✨

@davidcelis davidcelis merged commit 89f89ca into davidcelis:master May 18, 2017
@magnusfiorepalm
Copy link
Contributor Author

Awesome! @davidcelis any plans on cutting a new release with these changes?

@davidcelis
Copy link
Owner

Yup, just had to get back to my computer from a camping trip. 4.6.0 is out!

@andrew
Copy link

andrew commented May 22, 2017

FYI this change breaks existing usage for rendering json like so:

paginate json: @project.dependent_repositories

As will paginate doesn't recognize the :json option that now gets passed down to it

@davidcelis
Copy link
Owner

D'oh

I've just pushed a fix that will just additionally pass total_entries and will be releasing 4.6.1 in a sec.

@andrew
Copy link

andrew commented May 25, 2017

@davidcelis wonderful, thanks!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants