Activeresource and pagination

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

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, [email protected] [email protected]
wrote:


Ekta Goel
Software Engineer
Mobera Systems
www.moberasystems.com
Chandigarh

  • 91-9876967932

[email protected] 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 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.