Changeset 238
- Timestamp:
- 09/10/07 08:33:47 (1 year ago)
- Files:
-
- trunk/demo/test/unit/content_test.rb (modified) (2 diffs)
- trunk/plugin/acts_as_ferret/lib/class_methods.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/demo/test/unit/content_test.rb
r236 r238 669 669 more_contents 670 670 671 r = Content.find_with_ferret 'title', :p age => 1, :per_page => 10, :sort => 'title'671 r = Content.find_with_ferret 'title', :per_page => 10, :sort => 'title' 672 672 assert_equal 30, r.total_hits 673 673 assert_equal 10, r.size … … 677 677 assert_equal 3, r.page_count 678 678 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' 680 680 assert_equal 30, r.total_hits 681 681 assert_equal 10, r.size trunk/plugin/acts_as_ferret/lib/class_methods.rb
r234 r238 145 145 # +conitions+ present in +find_options+. 146 146 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 148 149 limit = options[:per_page] 149 150 offset = (options[:page] - 1) * limit
