Sha256: 8153c231197364589c0f3d616c1c6516c29c53c44cca9504f70c3a345c075963
Contents?: true
Size: 702 Bytes
Versions: 1
Compression:
Stored size: 702 Bytes
Contents
require 'sequel' require 'sequel/extensions/pagination' module WillPaginate # Sequel already supports pagination; we only need to make the # resulting dataset look a bit more like WillPaginate::Collection module SequelMethods def total_pages page_count end def per_page page_size end def size current_page_record_count end alias length size def total_entries pagination_record_count end def out_of_bounds? current_page > total_pages end # Current offset of the paginated collection def offset (current_page - 1) * per_page end end Sequel::Dataset::Pagination.send(:include, SequelMethods) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
will_paginate-3.0.0 | lib/will_paginate/sequel.rb |