Hi all,
This is my controller function where am getting some collection of
objects using sql query.
def displaysearchlist
var=params[:txtsearch]
@userinformation_pages, @userinformations paginate(:userinformations,
:conditions => "LoginName like ''%#{var}
%''", :order => "LoginName asc", :per_page => 2)
end
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">
<tr>
<td align="left" width="100%"
class="generallink">Page:
<%@userinformation_pages.current.number %> <%= link_to
''Previous'',
{ :page => @userinformation_pages.current.previous } if
@userinformation_pages.current.previous %>
<%= link_to ''Next '', { :page =>
@userinformation_pages.current.next }
if @userinformation_pages.current.next %> </td>
</tr>
</table>
How to create paging for query related collections??
OR do i have create any session ??
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---