问题
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