# Activeresource and pagination

**URL:** <https://www.ruby-forum.com/t/activeresource-and-pagination/133123>\
**Category:** Rails\
**Created:** [March 28, 2008, 2:12am UTC](https://www.ruby-forum.com/t/activeresource-and-pagination/133123 "2008-03-28T02:12:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 28, 2008, 2:12am UTC](https://www.ruby-forum.com/t/activeresource-and-pagination/133123/1 "2008-03-28T02:12:30Z")

</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:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 28, 2008, 6:07am UTC](https://www.ruby-forum.com/t/activeresource-and-pagination/133123/2 "2008-03-28T06:07:09Z")

</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:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 28, 2008, 6:07am UTC](https://www.ruby-forum.com/t/activeresource-and-pagination/133123/3 "2008-03-28T06:07:09Z")

</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

On Fri, Mar 28, 2008 at 6:41 AM, removed\_email\_address@domain.invalid [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> >

–  
Ekta Goel  
Software Engineer  
Mobera Systems  
[www.moberasystems.com](http://www.moberasystems.com)  
Chandigarh

- 91-9876967932

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 15, 2010, 12:06am UTC](https://www.ruby-forum.com/t/activeresource-and-pagination/133123/4 "2010-02-15T00:06:48Z")

</div>

removed\_email\_address@domain.invalid 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 [PoxPaginate](http://github.com/c42/pox_paginate) 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.
