Skip to content

Commit

Permalink
Docs: Added warning info for ActiveRecord limit overridden by the :it…
Browse files Browse the repository at this point in the history
…ems variable (closes #461)
  • Loading branch information
ddnexus committed Feb 9, 2023
1 parent 19b5bb3 commit 8873d11
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/how-to.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ You can also pass it as an instance variable to the `Pagy.new` method or to the
@pagy, @records = pagy(Product.some_scope, items: 30)
```

!!! warning ActiveRecord `limit`
The defined `:items` variable overrides any `limit` already set in ActiveRecord collections:

```ruby
@pagy, @products = pagy(Product.limit(5)) #=> limit(5) gets overridden
```
!!!

See also a couple of extras that handle the `:items` in some special way:

- [gearbox](extras/gearbox.md): Automatically change the number of items per page depending on the page number
Expand Down

0 comments on commit 8873d11

Please sign in to comment.