I am trying to use will_paginate for a Rails 3.2 application and I have not seen any link anywhere for what happens when someone is paging and the data in db changes. More specifically, new entries are added.
Maybe something is missing for me, but if I get how it works, will_paginate just counts the entries in the database. Let's say I load a page with 5 entries at a time and want them to be ordered first for a new product. The user loads the page and receives records 6-10 (the newest records at that time) shown on page 1. Then someone inserts another record into the table, id = 11. After that, the first user clicks to go to page 2, but now on page 2 are records 2-6. Thus, the user received id = 6 on both pages.
This problem does not sound so bad, but it is very bad if you want to use will_paginate paging to scroll endlessly, as shown here: http://railscasts.com/episodes/114-endless-page
I thought about adding a timestamp for loading the first page and passing it to successive ajax calls to filter by the records that were present at the beginning so as not to get duplicates.
Is there any better way to handle this?
Odded source
share