Skip to content
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

NameError: uninitialized constant Pagy::Cursor::DEFAULT #48

Closed
crazyoptimist opened this issue Dec 29, 2022 · 2 comments
Closed

NameError: uninitialized constant Pagy::Cursor::DEFAULT #48

crazyoptimist opened this issue Dec 29, 2022 · 2 comments

Comments

@crazyoptimist
Copy link

I just tried to follow the Usage in README, and got this error.

E, [2022-12-29T02:19:42.696554 #9116] ERROR -- : NameError: uninitialized constant Pagy::Cursor::DEFAULT

      @vars = DEFAULT.merge(vars.delete_if{|_,v| v.nil? || v == '' })
              ^^^^^^^
  /home/debian/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/pagy_cursor-0.5.0/lib/pagy_cursor/pagy/cursor.rb:9:in `initialize'
  /home/debian/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/pagy_cursor-0.5.0/lib/pagy_cursor/pagy/extras/cursor.rb:8:in `new'
  /home/debian/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/pagy_cursor-0.5.0/lib/pagy_cursor/pagy/extras/cursor.rb:8:in `pagy_cursor'

It should look for Pagy::DEFAULT instead of Pagy::Cursor::DEFAULT. Do you have any idea why this happens?

@Uysim

@dblock
Copy link

dblock commented Dec 30, 2022

That should indeed be coming from https://github.com/ddnexus/pagy/blob/ffdff1c7b4577ca8deaf38cc66626dfdbb403c6d/lib/pagy.rb#L16, so Pagy::DEFAULT instead of Pagy::Cursor::DEFAULT. The permanent fix is probably to change the code in this library to Pagy::DEFAULT, but in your code @crazyoptimist I wonder whether require 'pagy' first would fix it?

@crazyoptimist
Copy link
Author

Yes it worked. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants