Changeset 342
- Timestamp:
- 05/05/08 11:43:07 (5 months ago)
- Files:
-
- trunk/plugin/acts_as_ferret/lib/search_results.rb (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/plugin/acts_as_ferret/lib/search_results.rb
r312 r342 5 5 class SearchResults < ActsAsFerret::BlankSlate 6 6 reveal :methods 7 attr_reader :current_page, :per_page, :total_hits 7 attr_reader :current_page, :per_page, :total_hits, :total_pages 8 8 alias total_entries total_hits # will_paginate compatibility 9 alias page_count total_pages # will_paginate backwards compatibility 9 10 10 11 def initialize(results, total_hits, current_page = 1, per_page = nil) … … 27 28 # code from here on was directly taken from will_paginate's collection.rb 28 29 29 #30 # The total number of pages.31 def page_count32 @total_pages33 end34 35 30 # Current offset of the paginated collection. If we're on the first page, 36 31 # it is always 0. If we're on the 2nd page and there are 30 entries per page, … … 49 44 # current_page + 1 or nil if there is no next page 50 45 def next_page 51 current_page < page_count? (current_page + 1) : nil46 current_page < total_pages ? (current_page + 1) : nil 52 47 end 53 48 end
