Forum: Ruby on Rails Help with :limit :ofset loop?

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.
A1b9eba0eb63959837d03979944cf5e9?d=identicon&s=25 bxsitecover (Guest)
on 2007-07-31 11:56
(Received via mailing list)
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.
This topic is locked and can not be replied to.