Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add page method to abstract search

- allows search.page(i) if a search has not already been
  executed
  • Loading branch information...
commit 966baad47bee5a129b5d94cc1a9dcd9d482464c1 1 parent c648536
Caleb Cohoon & Eric Saxby authored
7 lib/sunspot_with_kaminari.rb
... ... @@ -1,3 +1,5 @@
  1 +require 'sunspot'
  2 +
1 3 module SunspotWithKaminari
2 4 module Search
3 5 module AbstractSearchInstanceMethods
@@ -32,6 +34,11 @@ def empty?
32 34 def any?
33 35 total > 0
34 36 end
  37 +
  38 + def page(current_page)
  39 + query.paginate(current_page, nil)
  40 + self.execute.results
  41 + end
35 42 end
36 43 end
37 44 end
1  sunspot_with_kaminari.gemspec
@@ -14,6 +14,7 @@ Gem::Specification.new do |s|
14 14
15 15 s.rubyforge_project = "sunspot_with_kaminari"
16 16
  17 + s.add_dependency 'sunspot'
17 18 s.add_dependency 'sunspot_rails'
18 19 s.add_dependency 'kaminari', '>= 0.14.0'
19 20

0 comments on commit 966baad

Please sign in to comment.
Something went wrong with that request. Please try again.