diff --git a/lib/couchrest/mixins/collection.rb b/lib/couchrest/mixins/collection.rb index ada1868..b248825 100644 --- a/lib/couchrest/mixins/collection.rb +++ b/lib/couchrest/mixins/collection.rb @@ -1,14 +1,5 @@ module CouchRest module Mixins - module PaginatedResults - def amount_pages - @amount_pages ||= 0 - end - def amount_pages=(value) - @amount_pages = value - end - end - module Collection def self.included(base) @@ -93,8 +84,6 @@ 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 # given type for each row that comes back from the view. If no @@ -122,11 +111,8 @@ module CouchRest def paginate(options = {}) page, per_page = parse_options(options) 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) results = convert_to_container_array(results) - results.extend(PaginatedResults) - results.amount_pages = @amount_pages results end diff --git a/spec/couchrest/more/extended_doc_view_spec.rb b/spec/couchrest/more/extended_doc_view_spec.rb index 8a780d3..de14f63 100644 --- a/spec/couchrest/more/extended_doc_view_spec.rb +++ b/spec/couchrest/more/extended_doc_view_spec.rb @@ -380,10 +380,6 @@ describe "ExtendedDocument views" do a.should_not be_nil end end - it "should have the amount of paginated pages" do - articles = Article.by_date :key => Date.today - articles.paginate(:per_page => 3).amount_pages.should == 3 - end it "should provide a class method to access the collection directly" do articles = Article.collection_proxy_for('Article', 'by_date', :descending => true, :key => Date.today, :include_docs => true)