# Activeresource and pagination.

**URL:** <https://discuss.rubyonrails.org/t/activeresource-and-pagination/27000>\
**Category:** rubyonrails-talk\
**Created:** [March 28, 2008, 1:11am UTC](https://discuss.rubyonrails.org/t/activeresource-and-pagination/27000 "2008-03-28T01:11:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hartian](https://avatars.discourse-cdn.com/v4/letter/h/d6d6ee/32.png) [@hartian](https://discuss.rubyonrails.org/u/hartian)\
**Post date:** [March 28, 2008, 1:11am UTC](https://discuss.rubyonrails.org/t/activeresource-and-pagination/27000/1 "2008-03-28T01:11:34Z")

</div>

Hi,

I am fairly new to rails and am trying to figure out the right way to do pagination with ActiveResource. I am considering just wrapping will\_paginate over everything but I before I do I was hoping to get some input from some more experienced developers.

Thanks,George

---

<div class="post-metadata">

**Author:** ![EKta](https://avatars.discourse-cdn.com/v4/letter/e/76d3ee/32.png) [@EKta](https://discuss.rubyonrails.org/u/EKta)\
**Post date:** [March 28, 2008, 5:06am UTC](https://discuss.rubyonrails.org/t/activeresource-and-pagination/27000/2 "2008-03-28T05:06:37Z")

</div>

I used tha pgination feature in Rails 2.0.2. It worked fairly well. FOr that:

> Include will\_paginate plugin in vendor folder. ANd write the code in the controller from where you are retrieving the table data from the datbase.

e.g. @peopledata = Person.paginate(:page =\> params[:page], :conditions =\> [...])

> If you want to set the number of list(e.g. 5) to be displayed per page

Include in model..person.rb

def self.per\_page 5 end

> In view adda line

\<% will\_paginate @peopleData %\>

Pagination will start working with next and previous.

Thanks Ekta

---

<div class="post-metadata">

**Author:** ![EKta](https://avatars.discourse-cdn.com/v4/letter/e/76d3ee/32.png) [@EKta](https://discuss.rubyonrails.org/u/EKta)\
**Post date:** [March 28, 2008, 5:06am UTC](https://discuss.rubyonrails.org/t/activeresource-and-pagination/27000/3 "2008-03-28T05:06:47Z")

</div>

I used tha pgination feature in Rails 2.0.2. It worked fairly well. FOr that:

> Include will\_paginate plugin in vendor folder. ANd write the code in the controller from where you are retrieving the table data from the datbase. e.g. @peopledata = Person.paginate(:page =\> params[:page], :conditions =\> […]) If you want to set the number of list(e.g. 5) to be displayed per page Include in model…person.rb

def self.per\_page 5 end

> In view adda line \<% will\_paginate @peopleData %\>

Pagination will start working with next and previous.

Thanks Ekta

---

<div class="post-metadata">

**Author:** ![11155](https://avatars.discourse-cdn.com/v4/letter/1/d26b3c/32.png) [@11155](https://discuss.rubyonrails.org/u/11155)\
**Post date:** [February 14, 2010, 11:06pm UTC](https://discuss.rubyonrails.org/t/activeresource-and-pagination/27000/4 "2010-02-14T23:06:48Z")

</div>

hartian@gmail.com wrote:

> Hi,
> 
> I am fairly new to rails and am trying to figure out the right way to do pagination with ActiveResource. I am considering just wrapping will\_paginate over everything but I before I do I was hoping to get some input from some more experienced developers.
> 
> Thanks,George

I think \<a href="[http://github.com/c42/pox\_paginate&quot;&gt;PoxPaginate&lt;/a&gt](http://github.com/c42/pox_paginate&quot;&gt;PoxPaginate&lt;/a&gt); is what you're looking for. It's based on ideas tested in production; basically on the server you do ActiveRecordKlass.paginate, and when you deserialise this on the ActiveResource end, you get a WillPaginateCollection.

Cheers, Sidu.
