# Will\_paginate problem

**URL:** <https://rubytalk.org/t/will-paginate-problem/53517>\
**Category:** ruby-talk\
**Created:** [22 May 2009 14:21 UTC](https://rubytalk.org/t/will-paginate-problem/53517 "2009-05-22T14:21:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Edou\_Suilen](https://avatars.discourse-cdn.com/v4/letter/e/ec9cab/32.png) [@Edou\_Suilen](https://rubytalk.org/u/Edou_Suilen)\
**Post date:** [22 May 2009 14:21 UTC](https://rubytalk.org/t/will-paginate-problem/53517/1 "2009-05-22T14:21:51Z")

</div>

Hi,  
I have a problem using paginate: i made the paginate to work, but it  
only shows results in the first page, whenever i click on the second or  
others it doesnt show results, and i have more then 2 results for that  
search.

this is the code

controller:

&nbsp;&nbsp;&nbsp;def searchnome  
&nbsp;&nbsp;&nbsp;nome = params[:nome]  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@posts = Post.paginate(:all,:conditions =\> ["name=?",  
"#{nome}"],:page =\> params[:page] ,:per\_page =\> 2 )  
&nbsp;&nbsp;end

view :

\<% @posts.each do |post| %\>  
&nbsp;&nbsp;\<tr\>  
&nbsp;&nbsp;&nbsp;&nbsp;\<td\>\<a\>Name : \</a\>\</td\>  
&nbsp;&nbsp;&nbsp;&nbsp;\<td\>\<%=h [post.name](http://post.name) %\>\</td\>\<br /\>  
&nbsp;&nbsp;&nbsp;&nbsp;\<td\>\<a\>Title : \</a\>\</td\>  
&nbsp;&nbsp;&nbsp;&nbsp;\<td\>\<%=h post.title %\>\</td\>\<br /\>  
&nbsp;&nbsp;&nbsp;&nbsp;\<td\>\<a\>Content\</a\>\</td\>\<br /\>  
&nbsp;&nbsp;&nbsp;&nbsp;\<td\>\<%=h post.content %\>\</td\>\<br /\>  
&nbsp;&nbsp;\</tr\>\<br /\>  
\<% end %\>  
\<br /\>  
\<%= will\_paginate @posts %\>

i am a bit new in ruby, any help is welcome 🙂

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
