views:

67

answers:

2

For some reason my will_paginate collection is stuck on page 2. I have the usual links the view helper provides except every page after page one links to http://localhost:3000/ceo/gr_messages?page=2 I have tried to add the :order option with no luck. I have also ensured that the request is a get as mentioned on this page: http://wiki.github.com/mislav/will_paginate/simple-search

Any other thoughts or suggestions would be appreciated.

def gr_messages
@organisation.gold_care!
@messages = @organisation.messages.paginate(:per_page => 10, :page => params[:page], :order => 'id')

if request.xhr?
  render :partial => 'messages_and_pagination'
end
end
A: 

where is @organisation defined? What is @organisation.gold_care!? Please also show us the view code. You could be putting the will_pagiante @organisation in the wrong place.

Mike
A: 

This was a known bug in older will_paginate versions. Please update the gem:

gem update will_paginate
mislav
Hi Mislav, I was using version 2.3.7, which is not so old. I upgraded to 2.3.12 and the problem is still there. I am using the plugin if that makes any difference. Any ideas about where I should be looking to fix this?Thanks
Mike Williamson
Scratch that. I switched from the plugin to the gem and now its fine.Thanks!
Mike Williamson
Plugin (if you fetch code from git) and gem are the same code. They will work exactly the same way if you install them correctly. I recommend gem usage to most users because gems are easy to install and update.
mislav