The key lies in how paginate pages the data. For an ActiveRecord source, it generates the following ARel modifiers:
offset how many records to skip before starting collection
limit how many records to include in the collection
will_paginate's default processing is to use offset => (pager.offset) and limit => (pager.per_page), but what you want is offset => (pager.page - 1), limit => (pager.per_page). This can be accomplished by performing manual paging, as documented with WillPaginate::Collection:
# Just like +new+, but yields the object after instantiation and returns it
There may be an easier way to accomplish this -- let's see what others say.
On Feb 10, 2012, at 7:36 PM, Rembrant wrote:
> I want to show (3) records per page but when the next or previous
> | 1 2 3 | 4 5
> 1 | 2 3 4 | 5
> Any help would be greatly appreciated.
> Many thanks,
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.