Sha256: 986926b9cf2fd0166dd281e4eca42868755f471de5a9ddbd9a8e9f2bdf830d06

Contents?: true

Size: 587 Bytes

Versions: 1

Compression:

Stored size: 587 Bytes

Contents

module Rao
  module ResourcesController::WillPaginateConcern
    extend ActiveSupport::Concern

    included do
      helper_method :paginate?
    end

    def paginate?
      true
    end

    private

    def load_collection
      options = { page: params[:page] }
      options[:per_page] = per_page unless per_page.nil?
      @collection = load_collection_scope.paginate(options)
    end

    def per_page
      if [nil, 'all'].include?(params[:per_page])
        nil
      else
        Rao::ResourcesController::Configuration.pagination_per_page_default
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rao-resources_controller-0.0.21.pre app/concerns/rao/resources_controller/will_paginate_concern.rb