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

Warn when no ordering is in place #1054

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

radiokills
Copy link

Hey, I'm submitting the PR that adds a warning when no ordering is in place.

This code is connected to the following:
#1042 and
#1040 (I think this one explains the issue well enough)

This code will for sure screw the test output quite a bit but for a good reason.
I mean, for sure the correct ordering is the responsibility of the developer who uses this gem, however, I believe in this case it is easily missed, especially because there is (still) no warning in the documentation, also the existing tests don't offer a good practice example. (I am prepared to fix existing tests as well, please let me know if this PR is acceptable. )

Not using ordering, can lead to some nasty consequences especially when Kaminari is used in an API.

There is also another option to resolve this issue (albeit more intrusive):
The default order by column could be added to the config and then prepend it to the 'page' scope.
(Another variant would be to use the primary key of the model if exists)

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.

None yet

1 participant