# Pagination problem

**URL:** <https://www.ruby-forum.com/t/pagination-problem/186824>\
**Category:** Ruby\
**Created:** [April 13, 2010, 2:02am UTC](https://www.ruby-forum.com/t/pagination-problem/186824 "2010-04-13T02:02:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vinjenace](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/d9b06d/32.png) [@vinjenace](https://www.ruby-forum.com/u/vinjenace)\
**Post date:** [April 13, 2010, 2:02am UTC](https://www.ruby-forum.com/t/pagination-problem/186824/1 "2010-04-13T02:02:14Z")

</div>

I have a filter function on my page so I can see the only records that I  
want to but my problem is, in my pagination I only alot 100 record a  
page and everytime I click the 2 or next it always brings me the 2nd  
page of the whole record not the filtered ones.

---

<div class="post-metadata">

**Author:** ![vinjenace](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/d9b06d/32.png) [@vinjenace](https://www.ruby-forum.com/u/vinjenace)\
**Post date:** [April 13, 2010, 3:44am UTC](https://www.ruby-forum.com/t/pagination-problem/186824/2 "2010-04-13T03:44:55Z")

</div>

Vincent Hernandez wrote:

> I have a filter function on my page so I can see the only records that I  
> want to but my problem is, in my pagination I only alot 100 record a  
> page and everytime I click the 2 or next it always brings me the 2nd  
> page of the whole record not the filtered ones.

better show your code.

---

<div class="post-metadata">

**Author:** ![vinjenace](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/d9b06d/32.png) [@vinjenace](https://www.ruby-forum.com/u/vinjenace)\
**Post date:** [April 13, 2010, 4:26am UTC](https://www.ruby-forum.com/t/pagination-problem/186824/3 "2010-04-13T04:26:35Z")

</div>

Chen Ge wrote:

> Vincent Hernandez wrote:
> 
> > I have a filter function on my page so I can see the only records that I  
> > want to but my problem is, in my pagination I only alot 100 record a  
> > page and everytime I click the 2 or next it always brings me the 2nd  
> > page of the whole record not the filtered ones.
> 
> better show your code.

\<%= link\_to ‘Prev’, { :page =\> @nercdb\_pages.current.previous } if  
@nercdb\_pages.current.previous %\>  
\<% if @nercdb\_pages.page\_count \> 100%\>  
\<%= pagination\_links @nercdb\_pages %\>  
\<%= link\_to ‘Next’, { :page =\> @nercdb\_pages.current.next } if  
@nercdb\_pages.current.next %\>  
\<% else %\>  
\<% for page in @nercdb\_pages %\>  
\<%= link\_to\_unless(params[:page].to\_i == page.number,  
page.number,  
{:params =\> params.merge(‘page’ =\> page)},  
{:class =\> ‘linked\_page’}) {|link\_name| “#{link\_name}”} %\>&nbsp;  
\<% end %\>  
\<%= link\_to ‘Next’, { :page =\> @nercdb\_pages.current.next } if  
@nercdb\_pages.current.next %\>
