Custom paginator generating Next link when not needed

I implemented a prefix search using the following custom paginator:

@performer_pages = self, Performer.count, 25,
@performers = Performer.find( :all,
:conditions => [“Name >= ?”, params[:prefix] ],
:order => “Name ASC”, :limit =>
: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 => } if %>

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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs