Skip to content

Remove warnings if user has explicitly defined paginator #36

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

Merged
merged 1 commit into from
Feb 10, 2015

Conversation

eidge
Copy link
Contributor

@eidge eidge commented Feb 9, 2015

This PR defers warnings to the first time ApiPagination.configuration.paginator is called.

This way no warnings will be generated if someone has explicitly defined a paginator even though more than one might be present.

@davidcelis
Copy link
Owner

This looks good; thanks! Would you mind squashing your two commits before I merge?

… if user hasn't explicitly set one of the paginators
@eidge
Copy link
Contributor Author

eidge commented Feb 10, 2015

Done, thanks ;)

Hugo Ribeira

Jack of All Trades at *intoCros http://intocross.coms
http://intocross.com *
Tel: +351 910982209 http://910982209 * LinkedIn
http://pt.linkedin.com/pub/hugo-ribeira/45/295/536/ * GitHub
https://github.com/eidge
Universidade de Coimbra

2015-02-09 19:58 GMT+00:00 David Celis [email protected]:

This looks good; thanks! Would you mind squashing your two commits before
I merge?


Reply to this email directly or view it on GitHub
#36 (comment)
.

davidcelis added a commit that referenced this pull request Feb 10, 2015
Remove warnings if user has explicitly defined paginator
@davidcelis davidcelis merged commit 3c6a7cb into davidcelis:master Feb 10, 2015
@eidge eidge deleted the delay-warnings branch February 10, 2015 18:05
@sdsantos
Copy link

@davidcelis can you bump the gem version? Would love to avoid the warning :)

@davidcelis
Copy link
Owner

Hmmm. There’s one thing I’m still thinking about, which is that there’s still a possibility of someone including api-pagination without including kaminari or will_paginate. Now no warning is printed until, most likely, someone hits an endpoint that tries to paginate. Then the warning would be printed and they would immediately get exceptions. I’d rather that warning appear on booting the application, but I’m trying to figure out a good way to separate that warning from the “less important” warning.

@eidge
Copy link
Contributor Author

eidge commented Feb 11, 2015

One could run an extra verification that checks whether both kaminari and
will_paginate are undefined. Which should be way more rare and dangerous
than having both. What do you think?

Hugo Ribeira

Jack of All Trades at *intoCros http://intocross.coms
http://intocross.com *
Tel: +351 910982209 http://910982209 * LinkedIn
http://pt.linkedin.com/pub/hugo-ribeira/45/295/536/ * GitHub
https://github.com/eidge
Universidade de Coimbra

2015-02-11 17:24 GMT+00:00 David Celis [email protected]:

Hmmm. There’s one thing I’m still thinking about, which is that there’s
still a possibility of someone including api-pagination without including
kaminari or will_paginate. Now no warning is printed until, most likely,
someone hits an endpoint that tries to paginate. Then the warning would be
printed and they would immediately get exceptions. I’d rather that
warning appear on booting the application, but I’m trying to figure out a
good way to separate that warning from the “less important” warning.


Reply to this email directly or view it on GitHub
#36 (comment)
.

davidcelis added a commit that referenced this pull request Feb 11, 2015
If the user has configured a paginator, the warning about Kaminari and
WillPaginate both appearing in the Gemfile should not be printed.
Additionally, this moves loading of Kaminari and WillPaginate back into
`hooks.rb` with a warning printed if neither gem is included. This
warning still gets printed when the user's application starts. Finally,
add a note to the README saying that we basically aren't going to try to
deal with people's Kaminari/WillPaginate conflicts anymore. Let them
sort that out themselves. Sorry, folks!

Related: #18, #36

Signed-off-by: David Celis <[email protected]>
@davidcelis
Copy link
Owner

I’m okay with what this latest commit does. Let me know if y’all have thoughts before I release.

@eidge
Copy link
Contributor Author

eidge commented Feb 11, 2015

Yup seems fine, the warning should not fire anymore unless both gems are present and none explicitly defined but still fires if none is present at start up time. Right?

The version bump is still necessary to update te the gem though, is it not?

Thanks for the support :)

@davidcelis
Copy link
Owner

Yep, I’ll bump the version in a bit

@davidcelis
Copy link
Owner

I’ve released versions 3.2.1 and 4.1.1.

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

Successfully merging this pull request may close these issues.

3 participants