Hi,
I’ve just stumbled across ‘will_paginate’, and I was wondering if anyone
knows if I could use a ‘find_by_sql’. The problem I’m facing is: I want
to paginate, but I only want to list the maximum row in each group.
Is this possible? Or is there any better way to do it?
Thanks
from will_paginate source code:
Example:
@developers = Developer.paginate_by_sql ['select * from developers
where salary > ?’, 80000], :page => params[:page], :per_page => 3
PP Junty wrote:
from will_paginate source code:
Example:
@developers = Developer.paginate_by_sql ['select * from developers
where salary > ?’, 80000], :page => params[:page], :per_page => 3
Great, looks promising. How would I find the most recent timestamp?
‘where max(created_at’) ?
Thanks!!