Should always include docs when paginating by Model##paginate
Fixes https://github.com/couchrest/couchrest_model/issues/81
This commit is contained in:
parent
6e025bb256
commit
5cee1734da
|
@ -244,6 +244,7 @@ module CouchRest
|
|||
else
|
||||
options = { :limit => per_page, :skip => per_page * (page - 1) }
|
||||
end
|
||||
options[:include_docs] = true
|
||||
view_options.merge(options)
|
||||
end
|
||||
|
||||
|
|
|
@ -27,21 +27,20 @@ describe "Collections" do
|
|||
end
|
||||
it "should provide a class method for paginate" do
|
||||
articles = Article.paginate(:design_doc => 'Article', :view_name => 'by_date',
|
||||
:per_page => 3, :descending => true, :key => Date.today, :include_docs => true)
|
||||
:per_page => 3, :descending => true, :key => Date.today)
|
||||
articles.size.should == 3
|
||||
|
||||
articles = Article.paginate(:design_doc => 'Article', :view_name => 'by_date',
|
||||
:per_page => 3, :page => 2, :descending => true, :key => Date.today, :include_docs => true)
|
||||
:per_page => 3, :page => 2, :descending => true, :key => Date.today)
|
||||
articles.size.should == 3
|
||||
|
||||
articles = Article.paginate(:design_doc => 'Article', :view_name => 'by_date',
|
||||
:per_page => 3, :page => 3, :descending => true, :key => Date.today, :include_docs => true)
|
||||
:per_page => 3, :page => 3, :descending => true, :key => Date.today)
|
||||
articles.size.should == 1
|
||||
end
|
||||
it "should provide a class method for paginated_each" do
|
||||
options = { :design_doc => 'Article', :view_name => 'by_date',
|
||||
:per_page => 3, :page => 1, :descending => true, :key => Date.today,
|
||||
:include_docs => true }
|
||||
:per_page => 3, :page => 1, :descending => true, :key => Date.today }
|
||||
Article.paginated_each(options) do |a|
|
||||
a.should_not be_nil
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue