mikewilliamson
mikewilliamson

Reputation: 24793

Will_paginate stuck on page 2

For some reasons, 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 here

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

Upvotes: 0

Views: 375

Answers (2)

Kurt Kiefer
Kurt Kiefer

Reputation: 21

Sorry to resurrect the dead here, but I wanted to add that I just shared and resolved a similar experience.

For me, will_paginate was running fine for months (Rails 2.3.8 and will_paginate 2.3.15), and then all of a sudden, I began having the same problem as you on 2/3 servers (without making ANY changes to packages on the server or code).

I fixed the problem by uninstalling will_paginate, restarting the rails server, re-installing will_paginate, and restarting one more time. Restarting rails in the middle and having it come up in a faulted state was necessary for this to work.

Upvotes: 2

mislav
mislav

Reputation: 15209

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

gem update will_paginate

Upvotes: 0

Related Questions