Forum: Ruby on Rails will_paginate working in the opposite way expected

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
059ed46172a087063ce26250e44c8627?d=identicon&s=25 Fernando Perez (fernando)
on 2008-12-27 19:38
Hi,

I am creating a little blogging engine, so I want the most recent posts
to display first, so I make a search with :order => 'created_at DESC'

For some reason, will_paginate works the opposite way I expect it to be.
I mean the previous / next links are opposite to what I want. What could
I be doing wrong?
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2008-12-28 00:25
(Received via mailing list)
On 27 Dec 2008, at 18:38, Fernando Perez wrote:

> could
> I be doing wrong?

As in Next fetches older posts ? If so you're not doing anything
wrong. While you may thing of next as more recents posts,
will_paginate only cares about it being the next page.
You can tell will_paginate what labels to use for the links  with
the :next_label/:previous_label options so you can swap them around or
use something less ambiguous like older/newer

Fred
059ed46172a087063ce26250e44c8627?d=identicon&s=25 Fernando Perez (fernando)
on 2008-12-29 18:36
Frederick Cheung wrote:
> On 27 Dec 2008, at 18:38, Fernando Perez wrote:
>
>> could
>> I be doing wrong?
>
> As in Next fetches older posts ? If so you're not doing anything
> wrong. While you may thing of next as more recents posts,
> will_paginate only cares about it being the next page.
> You can tell will_paginate what labels to use for the links  with
> the :next_label/:previous_label options so you can swap them around or
> use something less ambiguous like older/newer
>
> Fred

Ok I get it Frederick, so everything is working fine, it's just the name
that mixed me up. Thanks.
This topic is locked and can not be replied to.