Comments (3)
Hi @lasha-meister,
Not sure about how you get that...
0> Book.all.count
D, [2024-03-19T19:45:51.028977 #6880] DEBUG -- : Book Count (0.1ms) SELECT COUNT(*) FROM "books"
=> 11
0> Book.all.count(:id)
D, [2024-03-19T19:45:56.231342 #6880] DEBUG -- : Book Count (0.2ms) SELECT COUNT("books"."id") FROM "books"
=> 11
0> p, r = pagy(Book.all)
D, [2024-03-19T19:46:07.115069 #6880] DEBUG -- : Book Count (0.1ms) SELECT COUNT(*) FROM "books"
D, [2024-03-19T19:46:07.140286 #6880] DEBUG -- : Book Load (0.4ms) SELECT "books".* FROM "books" /* loading for inspect */ LIMIT ? OFFSET ? [["LIMIT", 11], ["OFFSET", 0]]
=> Error: the evaluation of `to_s` with the arguments `[]` failed with the exception 'SQLite3::SQLException: no such table: books'
0> p, r = pagy(Book.all, count_args: :id)
D, [2024-03-19T19:46:53.505508 #6880] DEBUG -- : Book Count (0.1ms) SELECT COUNT("books"."id") FROM "books"
D, [2024-03-19T19:46:53.510209 #6880] DEBUG -- : Book Load (0.5ms) SELECT "books".* FROM "books" /* loading for inspect */ LIMIT ? OFFSET ? [["LIMIT", 11], ["OFFSET", 0]]
=> Error: the evaluation of `to_s` with the arguments `[]` failed with the exception 'SQLite3::SQLException: no such table: books'
from pagy.
Hi @lasha-meister, Not sure about how you get that...
0> Book.all.count D, [2024-03-19T19:45:51.028977 #6880] DEBUG -- : Book Count (0.1ms) SELECT COUNT(*) FROM "books" => 11 0> Book.all.count(:id) D, [2024-03-19T19:45:56.231342 #6880] DEBUG -- : Book Count (0.2ms) SELECT COUNT("books"."id") FROM "books" => 11 0> p, r = pagy(Book.all) D, [2024-03-19T19:46:07.115069 #6880] DEBUG -- : Book Count (0.1ms) SELECT COUNT(*) FROM "books" D, [2024-03-19T19:46:07.140286 #6880] DEBUG -- : Book Load (0.4ms) SELECT "books".* FROM "books" /* loading for inspect */ LIMIT ? OFFSET ? [["LIMIT", 11], ["OFFSET", 0]] => Error: the evaluation of `to_s` with the arguments `[]` failed with the exception 'SQLite3::SQLException: no such table: books' 0> p, r = pagy(Book.all, count_args: :id) D, [2024-03-19T19:46:53.505508 #6880] DEBUG -- : Book Count (0.1ms) SELECT COUNT("books"."id") FROM "books" D, [2024-03-19T19:46:53.510209 #6880] DEBUG -- : Book Load (0.5ms) SELECT "books".* FROM "books" /* loading for inspect */ LIMIT ? OFFSET ? [["LIMIT", 11], ["OFFSET", 0]] => Error: the evaluation of `to_s` with the arguments `[]` failed with the exception 'SQLite3::SQLException: no such table: books'
That's the thing, with the console I also get correct behavior, but when I do this:
@pagy, @collection = pagy(@ranksack_collection, count_args: :id)
I get this in rack mini profiler, only after my monkey-patch do I get count on the id column :)
from pagy.
I cannot help without any provided code support.
I already ignored that fundamental prerequisite and answered to your issue, which only wasted both of our times, because we got exactly zero progress in understanding it.
You guessed a "solution" for your special case, which may be OK for your case, but it's worth nothing in the context of pagy, because we cannot even say whether it's a pagy issue, an AR issue, a DB issue, an issue of some other library used by your code or an issue of your own code.
By just guessing I would say that it's not a pagy issue at all, because either the way we pass the arguments to count is wrong in pagy (i.e. a design problem), OR it's not a problem with pagy since you get the same error without pagy. If it's wrong in pagy, then please point me to some doc that explains why and we will change pagy or its doc.
If you think it's pagy that is causing the problem, please provide some basic code (and please extract the very minimum from your app). Consider that I must be able to run it with a single command and reproduce it without steps to follow, configuration to prepare and especially no guessing.
Thank you for understanding.
from pagy.
Related Issues (20)
- Add ARIA attributes to foundation helpers
- Add ARIA attributes to materialize helpers
- Add ARIA attributes to semantic helper
- Add ARIA attributes to uikit helper
- Bug: pagy_search wrong number of arguments HOT 10
- Bug: Alias for an aggregate result is removed HOT 9
- Bug: Issue with Arel scope passed to pagy method HOT 3
- Docs: 7.0 has an undocumented breaking change for active page styling HOT 5
- Docs: Which branch should PRs be made against? HOT 3
- Docs: Update performance metrics HOT 5
- Trim doesn't call with pagy_nav_js when first page is active
- Bug: Adapt with Mongoid add extention HOT 1
- Docs: https://ddnexus.github.io/pagy/quick-start/#configure HOT 1
- Bug: Missing initializer in documentation HOT 1
- Bug: wrong number of arguments (given 2, expected 0) HOT 2
- Bug: wrong number of arguments (given 2, expected 0) HOT 1
- Bug: Pagy not working with Geocoder gem
- Bug: Undocumented backwards-incompatible change of empty "page" parameter introduced in 6.4.0 HOT 3
- Docs: lost section about wrap existing pagination with pagy_calendar HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pagy.