views:

26

answers:

1

If on the last item of a collection, I'd like a "next" link that displays the first item again.

A: 

Not too sure about Ruby, but in php you would have a count of your rows. You could then make some kind of if statement to change the next link to the beginning of your results..

$base_url = 'http://google.com/paging?p=';
$count = 100;
$per_page = 10;
$page = $_GET['p'];

if($page > $count/$per_page){

   $prev_link = $page - $per_page;
   $next_link = $base_url;

}

Let me know if that helps.

Peter
This is quite specific to the will_paginate plugin, which already solves everything you mentioned. I just want to add that one specific element.
Tass