Help With Loop please

New to rails! Thanks for reading

I have a database that stores link URL's and their names in one table.

DB Table is named: links

Model name : Link

Controller: admin

Links are stored in the "link_url" column Their names are stored in the "title" column They all are assigned an ID on auto increment.

What I want to do is display 10 links at a time out of (50+ links) And be able to rotate the links on a weekly basis, and display that in a partial.

Can anyone help me with this timed loop to display 10 links at a time

This is the default code to display them all.

<% for link in @links -%> <div class="linkss"">     <a href="<%= link.link_url %>"/><%= h(link.title) %></a> </div> <% end %>

How about selecting a range based on the day of month (so you can show a different subset of @links based on what week of the month you're in).

Something like:

case Time.now.day when 1..7   range = 0..10 when 8..14   range = 11..20 when 15..21   range = 21..30 else   range = 31..50 end

<% @links[range].each do |link| %>

- Ben

http://www.ticketi.sh/ Simple Help Ticket Tracking for People Who Want Less

...

What I want to do is display 10 links at a time out of (50+ links) And be able to rotate the links on a weekly basis, and display that in a partial.

Can anyone help me with this timed loop to display 10 links at a time from my db? Or refer me to a chapter in a rails book. Thanks!

...