Sha256: 05482d406b9067fba01cf9b84edcb656cda8e5e9d9b3e2f2aac6678f74c3e15f

Contents?: true

Size: 536 Bytes

Versions: 2

Compression:

Stored size: 536 Bytes

Contents

module Sequel::Plugins::LuxSimplePaginate
  module DatasetMethods
    def page size: 20, param: :page, page: nil
      page = (page || Lux.page.params[param]).to_i
      page = 1 if page < 1

      ret = paginate(page, size).all
      ret.define_singleton_method(:paginate_param) do; param ;end
      ret.define_singleton_method(:paginate_page)  do; page ;end
      ret.define_singleton_method(:paginate_size)  do; size ;end

      ret
    end
  end
end

Sequel::Model.db.extension :pagination
Sequel::Model.plugin :lux_simple_paginate

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lux-fw-0.1.35 ./lib/plugins/paginate/sequel_adapter.rb
lux-fw-0.1.17 ./lib/plugins/paginate/sequel_adapter.rb