dr plutes
2006-Jan-27 20:42 UTC
[Rails] custom paginator generating Next link when not needed
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 -- -- Posted via http://www.ruby-forum.com/.