You can clone with
No one assigned
Am I missing something here?
Let's say I have 5 records, and then I specify kaminari to paginate 20 records per page:
reports = Report.order('time asc').limit(5).page(1).per(20)
Then I check the total amount of returned reports:
# => 20
Why does it return 20 reports when there were only 5 reports in the relation?
I cannot really reproduce the issue, but AFAIK per(20) overrides limit(5)
If I only have 5 records in a relation, how could it be overriden by 20, if there are only 5 total. Where do the other 15 come from?
reports = Report.order('time asc').limit(5)
filtered_reports = reports.page(1).per(20)
My understadning is that page and per should only be working with the records in the current relation (which is a total of 5).
I see it just overrides the limit clause, but it won't override a where clause. Just the limit in a relation.
have you printed the contents of your reports? It would probably show you where the rest comes from.
What system, ruby and kaminari versions are you running. Maybe some of your other gems causes this?
what happens if you only query 5 items from the db without the pagination?
per is using limit internally and if you use limit twice on the relation object, latter will override previous.
Report.count # => 20
a = Report.limit(5).count # => 5
b = a.limit(20).count # => 20
Added to documentation with #383
I'm closing this issue since this is a natural behavior of ActiveRecord. @krzysztofbialek Thanks for the doc!