I think I am observing a bug with the total_pages count returned from
my will_paginate collection.  Or, is there some other page count I can
use that is more reliable?

I have a paginated list with a search box that is used to filter the
list.  The search string generates a :conditions clause that is used
to narrow the list.

My problem is that the paginate collection.total_pages count is
incoreect.  It reflects the size of the collection before
the :conditions.  Here is the code:

    args = { :page => params[:page], :per_page => 10, :order => "id
desc" }
    if params[:file_filter]
      args[:conditions] = ["file_fullpath LIKE ?",
"%#{params[:file_filter]}%"]
    end
    @files = @job.files.paginate(args)

The really annoying thing is the will_paginate view helper knows the
truth and generates the page number links correctly.  Looking at the
code it appears that the link renderer is using total_pages.  But when
I access it from my code it returns the too-large value.

--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to