Uysim / pagy-cursor

Cursor pagination with pagy for Ruby On Rails
MIT License
126 stars 23 forks source link

NoMethodError: undefined method `-' for nil:NilClass #60

Open cmrd-senya opened 1 year ago

cmrd-senya commented 1 year ago

When I try using pagy-cursor I receive exception. Here's how I use it:

p = pagy_cursor(User.all)
pagy_nav(p[0])

Here's what I get:

> pagy_nav(p[0])
NoMethodError: undefined method `-' for nil:NilClass
from /home/senya/.rvm/gems/ruby-3.2.2/gems/pagy-6.0.4/lib/pagy.rb:56:in `series'

Besides, any methods from pagy return nil:

[89] pry(#<>)> p[0].count
=> nil
[90] pry(#<>)> p[0].page
=> nil
[91] pry(#<>)> p[0].pages
=> nil
[92] pry(#<>)> p[0].series
NoMethodError: undefined method `-' for nil:NilClass
from /home/senya/.rvm/gems/ruby-3.2.2/gems/pagy-6.0.4/lib/pagy.rb:56:in `series'
[93] pry(#<>)> p[0].next
=> nil
[94] pry(#<>)> p[0].last
=> nil
[95] pry(#<>)> p[0].vars
=> {:page=>1,
 :items=>20,
 :outset=>0,
 :size=>[1, 4, 4, 1],
 :page_param=>:page,
 :params=>{},
 :fragment=>"",
 :link_extra=>"",
 :i18n_key=>"pagy.item_name",
 :cycle=>false,
 :request_path=>"",
 :arel_table=>.......

pagy-cursor version I use is 0.6.1