Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Will Paginate support inside couchrest

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 Rakefile
Octocat-spinner-32 VERSION
README.rdoc

Will Paginate for Couchrest

Adds support for the will_paginate gem by mislav to couchrest.

Inspired by Kenneth Kalmer's post:

www.opensourcery.co.za/2010/02/08/paginating-documents-with-couchrest-and-will_paginate/

Automatically generate views with an extra reduce method used to generate the total number of documents.

History

2010-06-26 - 0.3.1 - Minor fix, duplicate view options to avoid ExtendedDocument bug

2010-06-21 - 0.3.0 - Added support for new CouchRest Model

2010-04-05 - 0.2.0 - Added support for CouchRest Proxy class

2010-03-05 - 0.1.0 - Initial version

Install

gem install will_paginate_couchrest

Usage

require 'rubygems'
require 'couchrest'
require 'will_paginate'
require 'will_paginate_couchrest'

class User < CouchRest::ExtendedDocument

  property :nickname

  paginated_view_by :nickname

end

# Parameter :per_page must be provided or an error will be raised. 
# Parameter :page will assume 1 if nil.
@users = User.paginate_by_nickname :page => 1, :per_page => 10, :key => 'Lorena'

# For pagination on all documents
@users = User.paginate_all :per_page => 10

# Standard views are created at the same time
@users = User.by_nickname :key => 'Lorena'

# Use standard will_paginate method or redefine as you see fit
will_paginate @users

Copyright

Copyright © 2010 Sam Lown @ autofiscal S.L. See LICENSE for details.

Something went wrong with that request. Please try again.