jeremyevans/sequel — Issue #413: Query and Pagination extensions don't work together.
Author: chanks
Created: 2012-01-05 02:17:21+00:00
State: open

Simple reproduction, where Unit is a bare Sequel model and both extensions are loaded:

Unit.query do
paginate 1, 50
end

Results in an error:

TypeError: can't convert nil into Hash
from /home/chris/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/sequel-3.31.0/lib/sequel/extensions/query.rb:47:in `merge!'
from /home/chris/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/sequel-3.31.0/lib/sequel/extensions/query.rb:47:in `clone'
from /home/chris/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/sequel-3.31.0/lib/sequel/dataset/query.rb:576:in `naked'
from /home/chris/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/sequel-3.31.0/lib/sequel/dataset/actions.rb:503:in `single_value'
from /home/chris/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/sequel-3.31.0/lib/sequel/dataset/actions.rb:212:in `get'
from /home/chris/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/sequel-3.31.0/lib/sequel/dataset/actions.rb:101:in `count'
from /home/chris/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/sequel-3.31.0/lib/sequel/extensions/pagination.rb:15:in `paginate'
from (irb):3:in `block in irb_binding'
from /home/chris/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/sequel-3.31.0/lib/sequel/extensions/query.rb:33:in `instance_eval'
from /home/chris/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/sequel-3.31.0/lib/sequel/extensions/query.rb:33:in `query'
from /home/chris/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/sequel-3.31.0/lib/sequel/model/base.rb:783:in `query'

While the following works as expected:

Unit.query do
# whatever other methods
end.paginate 1, 50