Merge commit 'mattetti/master'

This commit is contained in:
Peter Gumeson 2009-07-20 16:21:10 -07:00
commit d85155040a
5 changed files with 29 additions and 4 deletions

View file

@ -83,6 +83,8 @@ module CouchRest
DEFAULT_PAGE = 1
DEFAULT_PER_PAGE = 30
attr_accessor :amount_pages
# Create a new CollectionProxy to represent the specified view. If a
# container class is specified, the proxy will create an object of the
@ -110,7 +112,8 @@ module CouchRest
# See Collection.paginate
def paginate(options = {})
page, per_page = parse_options(options)
results = @database.view(@view_name, pagination_options(page, per_page))
results = @database.view(@view_name, pagination_options(page, per_page))
@amount_pages ||= (results['total_rows'].to_f / per_page.to_f).ceil
remember_where_we_left_off(results, page)
convert_to_container_array(results)
end