# How do i use paginate in the class that i written

**URL:** <https://www.ruby-forum.com/t/how-do-i-use-paginate-in-the-class-that-i-written/111162>\
**Category:** Rails\
**Created:** [August 3, 2007, 10:32am UTC](https://www.ruby-forum.com/t/how-do-i-use-paginate-in-the-class-that-i-written/111162 "2007-08-03T10:32:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![patrick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b2d939/32.png) [@patrick](https://www.ruby-forum.com/u/patrick)\
**Post date:** [August 3, 2007, 10:32am UTC](https://www.ruby-forum.com/t/how-do-i-use-paginate-in-the-class-that-i-written/111162/1 "2007-08-03T10:32:30Z")

</div>

Hi ~

I am writing a class that is used to make a search to the model. It  
has a method that return the result set of the search result and the  
pagination class. But how can i use ‘paginate’ method in my class so  
that i can pagintate the results? Is it need to use require or  
include ?

Thank you ~  
Patrick

---

<div class="post-metadata">

**Author:** ![patrick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b2d939/32.png) [@patrick](https://www.ruby-forum.com/u/patrick)\
**Post date:** [August 3, 2007, 10:49am UTC](https://www.ruby-forum.com/t/how-do-i-use-paginate-in-the-class-that-i-written/111162/2 "2007-08-03T10:49:31Z")

</div>

Hi,  
For this to work you have to use paginate\_collection method which is  
used for the collection we retrived from the model classes. Paginate  
is usually used for only the model classes.

Thanks  
Vishal.

---

<div class="post-metadata">

**Author:** ![patrick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b2d939/32.png) [@patrick](https://www.ruby-forum.com/u/patrick)\
**Post date:** [August 3, 2007, 2:37pm UTC](https://www.ruby-forum.com/t/how-do-i-use-paginate-in-the-class-that-i-written/111162/3 "2007-08-03T14:37:00Z")

</div>

Don’t use paginate() - it’s a deprecated method and removed in latest  
edge rails.

Instead, use will\_paginate() plugin - [http://errtheblog.com/post/4791](http://errtheblog.com/post/4791)

On 8/3/07, Patrick [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Patrick
> 
> >

–  
Cheers!

- Pratik  
[http://m.onkey.org](http://m.onkey.org)
