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

Changeset 238

Show
Ignore:
Timestamp:
09/10/07 08:33:47 (1 year ago)
Author:
jk
Message:

don't require page parameter to be present and deal with it being a string

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/demo/test/unit/content_test.rb

    r236 r238  
    669669    more_contents 
    670670 
    671     r = Content.find_with_ferret 'title', :page => 1, :per_page => 10, :sort => 'title' 
     671    r = Content.find_with_ferret 'title', :per_page => 10, :sort => 'title' 
    672672    assert_equal 30, r.total_hits 
    673673    assert_equal 10, r.size 
     
    677677    assert_equal 3, r.page_count 
    678678 
    679     r = Content.find_with_ferret 'title', :page => 2, :per_page => 10, :sort => 'title' 
     679    r = Content.find_with_ferret 'title', :page => '2', :per_page => 10, :sort => 'title' 
    680680    assert_equal 30, r.total_hits 
    681681    assert_equal 10, r.size 
  • trunk/plugin/acts_as_ferret/lib/class_methods.rb

    r234 r238  
    145145    # +conitions+ present in +find_options+. 
    146146    def find_with_ferret(q, options = {}, find_options = {}) 
    147       if options[:page] && options[:per_page] 
     147      if options[:per_page] 
     148        options[:page] = options[:page] ? options[:page].to_i : 1 
    148149        limit = options[:per_page] 
    149150        offset = (options[:page] - 1) * limit 

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