Sha256: 2be3468b885211d749271b7aea5db5eaefedaf1c1b2caf655bd3fb982a4afe24
Contents?: true
Size: 778 Bytes
Versions: 1
Compression:
Stored size: 778 Bytes
Contents
# WillPaginateSearch # Copyright (c) 2007 - 2010 Douglas F Shearer. # http://douglasfshearer.com module ActsAsIndexed module WillPaginate module Search def paginate_search(query, options) page, per_page, total_entries = wp_parse_options(options) total_entries ||= find_with_index(query,{},{:ids_only => true}).size returning ::WillPaginate::Collection.new(page, per_page, total_entries) do |pager| options.update :offset => pager.offset, :limit => pager.per_page options = options.delete_if {|key, value| [:page, :per_page].include?(key) } pager.replace find_with_index(query, options) end end end end end class ActiveRecord::Base extend ActsAsIndexed::WillPaginate::Search end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
acts_as_indexed-0.6.7 | lib/will_paginate_search.rb |