Help with View/Model


#1

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


#2

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 K.
http://kampers.net