# How to paginate an array of fetched results

**URL:** <https://www.ruby-forum.com/t/how-to-paginate-an-array-of-fetched-results/124069>\
**Category:** Rails\
**Created:** [December 24, 2007, 10:43am UTC](https://www.ruby-forum.com/t/how-to-paginate-an-array-of-fetched-results/124069 "2007-12-24T10:43:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ruchita](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/22d042/32.png) [@ruchita](https://www.ruby-forum.com/u/ruchita)\
**Post date:** [December 24, 2007, 10:43am UTC](https://www.ruby-forum.com/t/how-to-paginate-an-array-of-fetched-results/124069/1 "2007-12-24T10:43:25Z")

</div>

Hi all,

I have implemented the searching and the results of searching are coming  
in an array @products \<\< lineitems. I want to paginate this array.

Any help would be greatly appreciated.  
Thanks,  
Ruchita.

---

<div class="post-metadata">

**Author:** ![ruchita](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/22d042/32.png) [@ruchita](https://www.ruby-forum.com/u/ruchita)\
**Post date:** [December 24, 2007, 8:11pm UTC](https://www.ruby-forum.com/t/how-to-paginate-an-array-of-fetched-results/124069/2 "2007-12-24T20:11:04Z")

</div>

Use will\_paginate plugin, look for it in [railscasts.com](http://railscasts.com).

On Dec 24, 2007 1:43 AM, Ruchita S.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Hi all,
> 
> I have implemented the searching and the results of searching are coming  
> in an array @products \<\< lineitems. I want to paginate this array.

–  
[http://www.rubyplus.org/](http://www.rubyplus.org/)  
Free Ruby Screencasts

---

<div class="post-metadata">

**Author:** ![ruchita](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/22d042/32.png) [@ruchita](https://www.ruby-forum.com/u/ruchita)\
**Post date:** [December 25, 2007, 2:19pm UTC](https://www.ruby-forum.com/t/how-to-paginate-an-array-of-fetched-results/124069/3 "2007-12-25T14:19:43Z")

</div>

steps for doing pagination is specified here

> **[Pagination in Ruby On Rails using will\_paginate plugin](https://nasir.wordpress.com/2007/10/31/pagination-in-ruby-on-rails-using-will_paginate-plugin/)**
>
> We do pagination in Rails by using its built in paginate method in our controller def display\_data @display\_data\_pages, @display\_data = paginate(:location\_data, :conditions =\> \[“loc.update…

On Dec 24, 9:43 am, Ruchita S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![ruchita](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/22d042/32.png) [@ruchita](https://www.ruby-forum.com/u/ruchita)\
**Post date:** [December 26, 2007, 8:53am UTC](https://www.ruby-forum.com/t/how-to-paginate-an-array-of-fetched-results/124069/4 "2007-12-26T08:53:06Z")

</div>

nas wrote:

> steps for doing pagination is specified here  
> [Pagination in Ruby On Rails using will\_paginate plugin – Nasir Jamal](http://nasir.wordpress.com/2007/10/31/pagination-in-ruby-on-rails-using-will_paginate-plugin/)
> 
> On Dec 24, 9:43 am, Ruchita S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

Hello,

I need to paginate an array…  
example @products \<\< @lineitems.  
I don’t have any table of products, it is just an array of data.  
That’s why i don’t know what syntax to be used.
