will_paginate: pagination links are wrong

I put everything in a pastie to make it a bit more readable: http://pastie.org/593379

This is the gist:

Will_paginate doesn't play quite nice. The first result set is fine, and when I click on one of the paginated links, it returns the following error: Couldn't find DictatedExam with ID=filter_widget observe_field triggers filter_widget which calls the paginated search.. Which is then rendered in a partial.

Why do things simple when you can do it complicated, right ?


This is what the links look like. I have no idea what they're -supposed- to look like.


AND FIXED! I followed http://jellofishi.com/blog/?cat=3

I created app/helpers/remote_link_renderer.rb

class RemoteLinkRenderer < WillPaginate::LinkRenderer   def prepare(collection, options, template)     @remote = options.delete(:remote) || {}     super   end

  protected   def page_link(page, text, attributes = {})     @template.link_to_remote(text, {:url => url_for(page), :method => :post}.merge(@remote))   end end

And then in the environment.rb I added, after the Initializer block:

require "will_paginate" WillPaginate::ViewHelpers.pagination_options[:renderer] = 'RemoteLinkRenderer'

My will_paginate has become: <%= will_paginate dictated_exams, :params => {:date => date },     :remote => { :update => 'filter_counts'} %>

And now it all works..