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