To edit pages or tickets please login with username/password: aaf/aaf

Changeset 342 for trunk

Show
Ignore:
Timestamp:
05/05/08 11:43:07 (5 months ago)
Author:
jk
Message:

applied patch from #216

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plugin/acts_as_ferret/lib/search_results.rb

    r312 r342  
    55  class SearchResults < ActsAsFerret::BlankSlate 
    66    reveal :methods 
    7     attr_reader :current_page, :per_page, :total_hits 
     7    attr_reader :current_page, :per_page, :total_hits, :total_pages 
    88    alias total_entries total_hits  # will_paginate compatibility 
     9    alias page_count total_pages    # will_paginate backwards compatibility 
    910 
    1011    def initialize(results, total_hits, current_page = 1, per_page = nil) 
     
    2728    # code from here on was directly taken from will_paginate's collection.rb 
    2829 
    29     # 
    30     # The total number of pages. 
    31     def page_count 
    32       @total_pages 
    33     end 
    34  
    3530    # Current offset of the paginated collection. If we're on the first page, 
    3631    # it is always 0. If we're on the 2nd page and there are 30 entries per page, 
     
    4944    # current_page + 1 or nil if there is no next page 
    5045    def next_page 
    51       current_page < page_count ? (current_page + 1) : nil 
     46      current_page < total_pages ? (current_page + 1) : nil 
    5247    end 
    5348  end 

To edit pages or tickets please login with username/password: aaf/aaf