Sha256: e43c6977fdf114c174e4351395af3341f465cd969ddb27e8e5b52ace79551f5f
Contents?: true
Size: 464 Bytes
Versions: 14
Compression:
Stored size: 464 Bytes
Contents
require 'will_paginate/collection' # http://www.desimcadam.com/archives/8 Array.class_eval do def paginate(options = {}) raise ArgumentError, "parameter hash expected (got #{options.inspect})" unless Hash === options WillPaginate::Collection.create( options[:page] || 1, options[:per_page] || 30, options[:total_entries] || self.length ) { |pager| pager.replace self[pager.offset, pager.per_page].to_a } end end
Version data entries
14 entries across 14 versions & 1 rubygems