Forum: Ruby on Rails custom paginator generating Next link when not needed

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Da P. (Guest)
on 2006-01-27 22:42
I implemented a prefix search using the following custom paginator:

@performer_pages = Paginator.new self, Performer.count, 25,
@params['page']
@performers = Performer.find( :all,
          :conditions => ["Name >= ?", params[:prefix] ],
          :order => "Name ASC", :limit =>
@performer_pages.items_per_page,
          :offset => @performer_pages.current.offset )

The view (rhtml) creates the previous & next links like so:

<%= link_to 'Previous page', { :prefix => params[:prefix], :page =>
@performer_pages.current.previous } if @performer_pages.current.previous
%>
<%= link_to 'Next page', { :prefix => params[:prefix], :page =>
@performer_pages.current.next } if @performer_pages.current.next %>

While this creates the previous link appropriately, it creates the
'next' link when one is not required (i.e., the result for the 'next'
page view is empty).

?:-\    Any ideas?  Thanks --
This topic is locked and can not be replied to.