Forum: Ferret Problems with will_paginate plugin

30a8b79f183274893f25c0c667c55f1e?d=identicon&s=25 Juho Makkonen (kusti)
on 2008-09-01 18:24
I'm trying to paginate ferret search results with instructions given in
this tutorial:

Everything goes well except sorting. I want to sort the results by
created_at so that the newest record appears in the top of the first
page and the oldest in the bottom of the last. So I have these lines in
my controller:

s =, :reverse => true)
@listings = Listing.find_by_contents(query, {:page => params[:page],
:per_page => per_page.to_i, :sort => s}, {:conditions => conditions})

Sorting like this works when pagination is not used, and it also sorts
the first page correctly. The problem is that the pagination still puts
the oldest messages in the first page and the newest in the last page.
Apparently it sorts them like that by default. How can I make it to sort
the records like I want them to be sorted?
This topic is locked and can not be replied to.