Awesome? It frikkin' rules!
On Sun, Aug 16, 2009 at 01:59, wildchild <alexander.uva...
> Just an idea. Consider we have page_size = 20 and just 23 records in
> the storage. Why not display all 23 records without annoying "next
> page" link? Awesome?
But seriously—I've given this a thought when I was experiencing
disappointment if the last page had only a few records. But, having a
constant per_page value was good for consistency, so I never really dared to
cheat on my users this way.
It's easy to implement this if anyone wants to try it:
class Post < ActiveRecord::Base
result = super
if result.total_pages > 1 and (result.total_entries - result.size)
result += super(options.merge(:page => result.next_page))
result.paginate(:page => 1, :per_page => result.size)