Remove part of the README that might lead to incorrect results #1258
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.
It is not an actual issue with ransack itself, but I'm finding calling
to_a.uniq
on paginated active record collection misleading, it also can give incoherent results.if provided README example
@q.result.includes(:articles).page(params[:page]
returns a collection with duplicated results, then callingto_a.uniq
will reduce a number of returned records, that means that the page offset will no longer be correct.Steps to reproduce:
Current Result Only one Person record is returned on 1st page and 2nd Person record is returned on second page
Expected Result List of two Person records is returned on the 1st page and no Person records are returned on second page.
I provided a test repo illustrating the following issue https://github.com/RadekMolenda/to_a_uniq_case
Paginated search results that rely on
LIMIT
andOFFSET
resolved on the database level is industry standard in most of production setups that are using relational databases. Removingto_a.uniq
section from README makes sense for me because it could be confusing for less experienced developers to understand why in some cases query results are not returning correct number of records.