Skip to content

Commit

Permalink
Now it works with latest kaminari, adding documentation on usage
Browse files Browse the repository at this point in the history
  • Loading branch information
richardiux committed May 1, 2011
1 parent 9ebe6e9 commit 31b5a4a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,21 @@ on `Gemfile`

gem 'kaminari'
gem "sunspot_rails"
gem "sunspot_with_kaminari"
gem "sunspot_with_kaminari", '~> 0.1'
on the controller

@products ||= Product.search do
keywords params[:search]
paginate :page => params[:page], :per_page => 20
end
on the view you want to do something like this:

<ul>
<% @products.results.each do |product| %>
<li><%= product.name %></li>
<% end %>
</ul>

<%= paginate @products, :window => 1 %>
8 changes: 8 additions & 0 deletions lib/sunspot_with_kaminari.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ def num_pages
def limit_value
@query.per_page
end

def empty?
total == 0
end

def any?
total > 0
end
end
end
end

0 comments on commit 31b5a4a

Please sign in to comment.