Sha256: fcb4e7d5dd67942effd32812fd041c592b31dd60e9f13c2493a3c55c4788ba8b

Contents?: true

Size: 674 Bytes

Versions: 18

Compression:

Stored size: 674 Bytes

Contents

module Rao
  # Setting the pagination size in the controller:
  #
  #     # app/controllers/posts_controller.rb
  #     class PostsController < ApplicationController
  #       # ...
  #       private
  #
  #       def per_page
  #         15
  #       end
  #     end
  #
  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 if respond_to?(:per_page, true)
      @collection = load_collection_scope.paginate(options)
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
rao-resources_controller-0.0.20.pre app/concerns/rao/resources_controller/will_paginate_concern.rb
rao-resources_controller-0.0.19.pre app/concerns/rao/resources_controller/will_paginate_concern.rb
rao-resources_controller-0.0.18.pre app/concerns/rao/resources_controller/will_paginate_concern.rb
rao-resources_controller-0.0.17.pre app/concerns/rao/resources_controller/will_paginate_concern.rb
rao-resources_controller-0.0.16.pre app/concerns/rao/resources_controller/will_paginate_concern.rb
rao-resources_controller-0.0.15.pre app/concerns/rao/resources_controller/will_paginate_concern.rb
rao-resources_controller-0.0.14.pre app/concerns/rao/resources_controller/will_paginate_concern.rb
rao-resources_controller-0.0.13.pre app/concerns/rao/resources_controller/will_paginate_concern.rb
rao-resources_controller-0.0.12.pre app/concerns/rao/resources_controller/will_paginate_concern.rb
rao-resources_controller-0.0.11.pre app/concerns/rao/resources_controller/will_paginate_concern.rb
rao-resources_controller-0.0.10.pre app/concerns/rao/resources_controller/will_paginate_concern.rb
rao-resources_controller-0.0.9.pre app/concerns/rao/resources_controller/will_paginate_concern.rb
rao-resources_controller-0.0.8.pre app/concerns/rao/resources_controller/will_paginate_concern.rb
rao-resources_controller-0.0.7.pre app/concerns/rao/resources_controller/will_paginate_concern.rb
rao-resources_controller-0.0.6.pre app/concerns/rao/resources_controller/will_paginate_concern.rb
rao-resources_controller-0.0.5.pre app/concerns/rao/resources_controller/will_paginate_concern.rb
rao-resources_controller-0.0.4.pre app/concerns/rao/resources_controller/will_paginate_concern.rb
rao-resources_controller-0.0.3.pre app/concerns/rao/resources_controller/will_paginate_concern.rb