Sha256: 2b612ae17445f09d2db1460cd7aeb1d5b72ac79691ece2d65568cf4cea699156

Contents?: true

Size: 394 Bytes

Versions: 2

Compression:

Stored size: 394 Bytes

Contents

module Hanami
  module Pagination
    module Action
      def self.included(action)
        action.class_eval do
          expose :pager
        end
      end

      def all_for_page(relation)
        relation = relation.per_page(limit).page(params[:page] || 1)
        @pager = Pager.new(relation.pager)
        relation.to_a
      end

      def limit
        100
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hanami-pagination-0.2.0 lib/hanami/pagination/action.rb
hanami-pagination-0.1.0 lib/hanami/pagination/action.rb