Using Ajax pagination via the will_paginate gem I’m having an issue rendering my collection since adding the pagination: I cannot display the indexes properly.
For example, in my view, I render the collection:
<%= render @songs %>
In the song partial, I have the following to help make the list look pretty:
<%= @songs.index(song) + 1 %>
My pagination is twitter-style, in that every time someone clicks “more”, it shoots out 5 more songs. The issue is the index of the collection is always 0-4 as my collection is limited to 5 via the pagination arguments.
What should I do to get these indexes working? Should I be getting two collections in my controller, one for pagination and one that is not simply for rendering the index?
Thanks
(adjust as needed for fencepost errors)