# Pagination problem using will\_paginate with two models

**URL:** <https://www.ruby-forum.com/t/pagination-problem-using-will-paginate-with-two-models/159501>\
**Category:** Rails\
**Created:** [February 5, 2009, 5:25am UTC](https://www.ruby-forum.com/t/pagination-problem-using-will-paginate-with-two-models/159501 "2009-02-05T05:25:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![srikanth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f9ae1b/32.png) [@srikanth](https://www.ruby-forum.com/u/srikanth)\
**Post date:** [February 5, 2009, 5:25am UTC](https://www.ruby-forum.com/t/pagination-problem-using-will-paginate-with-two-models/159501/1 "2009-02-05T05:25:04Z")

</div>

Hi,

let me explain my application details:

I have two controllers:  
1.streams\_controller  
2.search\_controller

And i have two models:  
1.stream.rb  
2.search.rb

in streams\_controller, i am uploading and downloading streams  
in search controller i am searching the streams from database.

Here i have used will\_paginate plugin for pagination in streams  
controller.It is working fine.  
to make it work i have added below code :

in controller:  
@streams = Stream.paginate(:page =\> params[:index],:per\_page =\> 2)

in view page:  
\<%= will\_paginate(@streams, :param\_name =\> ‘index’) -%\>

But in search controller if i use pagination its not happening .Simply  
it is showing the page number on display page .

i have added below code :  
in controller:  
@test2 = Stream.paginate(:page =\> params[:get\_results],:per\_page =\> 2)  
in view page:  
\<%= will\_paginate(@test2, :param\_name =\> ‘get\_results’) -%\>

here i am using same model ‘stream’ and collecting in test2.  
what could be the problem?  
Can any one suggest me to make it work?

thanks  
Srikanth
