-
Notifications
You must be signed in to change notification settings - Fork 407
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
Use count(:all) for AR #36
Comments
PostgreSQL? |
Yes, I haven't tried MySQL so not sure if it differs. It works with SQLite but haven't checked what is going on there. |
MySQL works... it's a known issue of PG, however it looks like the change wouldn't break anything. |
ddnexus
added a commit
that referenced
this issue
May 31, 2018
ddnexus
added a commit
that referenced
this issue
May 31, 2018
ddnexus
added a commit
that referenced
this issue
Jun 1, 2018
pushed to rubygem (v0.8.2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When specifying which columns to retrieve using .select in Active Record it causes an issue when using .count as it will use all the columns from the select. Instead '*' should be used by setting :all.
Code example: https://github.com/espen/pagy_count_bug/blob/master/app/controllers/users_controller.rb
Failing test: https://github.com/espen/pagy_count_bug/blob/master/test/controllers/users_controller_test.rb
Suggestion, use .count(:all) for AR in https://github.com/ddnexus/pagy/blob/master/lib/pagy/backend.rb#L21
The text was updated successfully, but these errors were encountered: