Skip to content
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

Setting override on per_page should not be done through additional param #8

Open
umtrey opened this issue Nov 19, 2014 · 1 comment

Comments

@umtrey
Copy link

umtrey commented Nov 19, 2014

@bellycard/platform

Right now, we suggest adding a new line to the napa params for per_page, to set the default. We can set a default within the code block in the API action, such as params[:per_page] ||= 100. This means that the params list would be cleaner.

@shaqq
Copy link

shaqq commented Nov 22, 2014

It seems we're hardcoding the page and per_page here:

https://github.com/bellycard/napa_pagination/blob/master/lib/napa_pagination/grape_helpers.rb#L29

It'd be nice to utilize the Kaminari hooks into ActiveRecord:

https://github.com/amatsuda/kaminari#configuring-default-per_page-value-for-each-model

The dream is probably implementing Kaminari::Helpers for Napa, and most likely scrap NapaPagination in favor for those helpers.

Here are the Sinatra Helpers as an example:

https://github.com/amatsuda/kaminari/blob/master/lib/kaminari/helpers/sinatra_helpers.rb
https://github.com/amatsuda/kaminari/tree/master/lib/kaminari/helpers

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

No branches or pull requests

2 participants