# Will\_paginate

**URL:** <https://www.ruby-forum.com/t/will-paginate/139591>\
**Category:** Rails\
**Created:** [June 5, 2008, 9:04am UTC](https://www.ruby-forum.com/t/will-paginate/139591 "2008-06-05T09:04:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![suneeta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b77776/32.png) [@suneeta](https://www.ruby-forum.com/u/suneeta)\
**Post date:** [June 5, 2008, 9:04am UTC](https://www.ruby-forum.com/t/will-paginate/139591/1 "2008-06-05T09:04:03Z")

</div>

Hi all…

I’m doing pagination using will\_paginate on data retrieved from three  
tables hardware\_cis, software\_cis, document\_cis  
The data retrieved from the tables are pushed into an array and the  
pagination is applied to that array. The code is as shown below:

## In controller:

```
@ci_result = Array.new
@hardware_cis=HardwareCi.hardware_cis_paginate(params[:ci],

```

params[:page])  
@software\_cis=SoftwareCi.software\_cis\_paginate(params[:ci],  
params[:page])  
@document\_cis=DocumentCi.document\_cis\_paginate(params[:ci],  
params[:page])  
@ci\_result \<\< @hardware\_cis  
@ci\_result \<\< @software\_cis  
@ci\_result \<\< @document\_cis

## In view:

\<%= will\_paginate @ci\_result[0], :params =\> { ‘ci’ =\> params[:ci] }  
%\>

The table hardware\_cis contains only 5 rows, software\_cis have 18 rows  
and document\_cis have 2 rows.  
While the above code is executed, data is paginated depending on the  
count of hardware\_cis table.  
That means, if I give :per\_page =\> 5 only one page is shown.  
If I give :per\_page=\>1, 5 pages are shown. All the 5 rows of  
hardware\_cis and all 2 rows of document\_cis are displayed. But only  
first 5 rows of software\_cis are shown.  
How can I do pagination in this case? Please help.

Thanks  
Suneeta  
displayed.
