Sha256: be989b29ceeb444385655cd2c70c5a94ac2dc479d6b0cfffbf626b997c25b6b9
Contents?: true
Size: 518 Bytes
Versions: 4
Compression:
Stored size: 518 Bytes
Contents
module DataTables module Modules class Pagination FIRST_PAGE = '0' DEFAULT_LENGTH = '10' attr_reader :scope, :context def initialize(model, scope, params) @scope = scope.dup @model = model @params = params end def paginate start = (@params[:start] || FIRST_PAGE).to_i length = (@params[:length] || DEFAULT_LENGTH).to_i page = (start / length) @scope.offset(page * length).limit(length) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems