Module: Rango::Pagination::Sequel::Dataset
- Defined in:
- lib/rango/contrib/pagination/adapters/sequel.rb
Instance Method Summary collapse
Instance Method Details
#paginate(current = 1, per_page = Page.per_page, options = nil) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/rango/contrib/pagination/adapters/sequel.rb', line 11 def paginate(current = 1, per_page = Page.per_page, = nil) current = current ? current.to_i : 1 # current can be nil or "1" page = Page.new(current: current, count: self.count, per_page: per_page) dataset = ? self.filter() : self return page, dataset.limit(per_page, (current - 1) * per_page) end |