Giter VIP home page Giter VIP logo

Comments (3)

ddnexus avatar ddnexus commented on May 28, 2024

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.

lasha-meister avatar lasha-meister commented on May 28, 2024

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 :)
Screenshot_20240319_151356

from pagy.

ddnexus avatar ddnexus commented on May 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.