Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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)