i have an architecture issue to solve with a rails app. I have gallery of images people can vote (up or down) for each day. Theses images get sorted by their score and their created_at timestamp so we got a top of day image galleries with 48 images (even if there were more than 48 images uploaded during the day).
Along with the top of the day you can see the top images of yesterday and two days before … I want to add the feature that allows someone to see the previous image of the gallery whenever he pick one image … in other words you can pick images 5/48 and be able by clicking on an arrow to go to the 4/48 images (the previous one) …
In the same way the previous image of the the first top image of yesterday should lead you to the last top image of today …
It may be simple but i can't find the right query to do the job … any suggestions please ?
Thanks