How can I set initial offset for first page in kaminari?

不羁岁月 提交于 2019-12-24 05:25:24

问题


I need to implement some logic for to show 3 elements on the first page and by 1 element on all the next. For the first page there is no problems:

items = @model.limit(@first_page_items)

and for all the next ones i tried:

@model.offset(@first_page_items).page(@current_page - 1).per(@per) #makes no offset at all - all the items going from the beginning
@model.page(@current_page - 1).per(@per).offset(@first_page_items) #produces 4-th element on the second page and stays on it for ever

What am I doing wrong? thx

来源:https://stackoverflow.com/questions/14306096/how-can-i-set-initial-offset-for-first-page-in-kaminari

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!