Help with :limit :ofset loop?


#1

This is the code in my model to display 10 records from a db table at
a time.

def self.find_5
find(:all,
:order => ‘id’,
:limit => 5, :offset => 0)
end

I want to make a loop so that say if my table contains 45 records and
the limit is find 5 records and the offset changes on a weekly basis
and one day overlaps my last record it will continue and pull from the
first record and so on.

Thank you for reading.