I have been trying out backbone JS with rails and really like the way it organises the frontend. I have implemented a pagination solution similar to the one here https://gist.gi
If your objective is to query & display items when a page is requested, you could do something like (pseudocode):
pages = {}
// when page N is needed
function fetch_page(n) {
if (!pages[n]) {
pages[n] = new ItemsCollection({page: n})
pages[n].fetch();
}
}
So you keep a collection for each page.
If you also need a collection of all the items fetched so far, just keep one - and add fetched items to it every time you get them from the server.