Forum: Ruby on Rails Help with View/Model.

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-06-23 09:42
(Received via mailing list)
Say you have a model and you scaffold it.  You can now create, update,
delete, show your item.  Say I have a limitless amount of records to
display.  I want to keep it like that in the backend, but On my
frontend I would only like to display 10 items at once, by ID in
order..... but each week I want it to move onto the next 10, until
oneday it loops back to the beginning.  Could someone please help me
with this?  Or suggestions of a more practical approach?  Thank you
624c731a73c56e2d8da1c5a9b3a7fa14?d=identicon&s=25 Chris Kampmeier (kampers)
on 2007-06-23 17:01
bxsitecover wrote:
> Say you have a model and you scaffold it.  You can now create, update,
> delete, show your item.  Say I have a limitless amount of records to
> display.  I want to keep it like that in the backend, but On my
> frontend I would only like to display 10 items at once, by ID in
> order..... but each week I want it to move onto the next 10, until
> oneday it loops back to the beginning.  Could someone please help me
> with this?  Or suggestions of a more practical approach?  Thank you

I assume you generated the scaffold code and you're not using 'scaffold
:model'.

If you just want ten (that is, you don't want pagination), you could
write a custom finder in your model. You could take the week number
since an arbitrary epoch, and multiply to fill out the :offset and
:limit parameters. Do some math with the number of records and the week
number to figure out when to start from the beginning again.

I'd suggest googling around for those things. The Rails book (Agile Web
Development with Rails) is great as well.

Chris Kampmeier
http://kampers.net
This topic is locked and can not be replied to.