Forum: Ruby on Rails Pagination - Next/Previous Linking problem

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
994fce1423e104ecd59fad58e740115f?d=identicon&s=25 manohar amrutkar (Guest)
on 2007-02-07 12:57
(Received via mailing list)
Hi all,

This is my controller function where am getting some collection of
objects using sql query.

def displaysearchlist
    @userinformation_pages, @userinformations =
paginate(:userinformations, :conditions  => "LoginName like '%#{var}
%'", :order => "LoginName asc", :per_page => 2)


In VIEW i want to display it with paging of 2 objects per page.

At first time it shows me the first page with correct entries.

But when  i clicks  on link 'next' or 'previous' it is shows me
entries from the table which are not related with the query. It shows
all the entries from the table as in List view.

 view code is: -

<table height="10" width="100%" border="0">
<td align="left" width="100%" class="generallink">Page: <%=
@userinformation_pages.current.number %>&nbsp;<%= link_to 'Previous',
{ :page => @userinformation_pages.current.previous } if
@userinformation_pages.current.previous %>
<%= link_to 'Next ', { :page => }
if %> </td>

How to create paging for query related collections??

OR do i have create any session ??
This topic is locked and can not be replied to.