Forum: Ruby on Rails simple paging question

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.
rbrant (Guest)
on 2005-12-04 19:42
(Received via mailing list)
I'm trying to page through records returned from a search:

donor controller:

  def search
    str = params[:donor][:search_string] + '%'
    @donor_pages, @donors = paginate :donors, :per_page => 5,
:conditions => ["last_name LIKE ?", str]
    render(:template => 'donor/list')

in my main view:

<%= text_field 'donor', 'search_string' %>

I'm trying to reuse the exsting 'list' template, which works, but I'm
wondering how to persist the search string in order to be able to page
thru the results.  I mean, I can think of various ways to do it, but
am unclear what the Rails way is. Do I simply append the search string
to the link?

This topic is locked and can not be replied to.