I use Kaminari for my Rails 3.2.0 site pagination. I'm hiding my deals object from displaying on the view by filtering it with <% if !traveldeal.expired? %>
where expired is a boolean.
I display 9 traveldeals per page as shown in my controller for the index action:
def index
@traveldeals = Traveldeal.order('created_at DESC').page(params[:page]).per(9)
end
Initially, the pagination worked fine with 9 traveldeals showing per page. However, when I manually set traveldeals from the first page to expired is true, the traveldeals that were set to expired no longer show up on the first page, but there are empty gaps and the elements from the 2nd page do not shift up.
The only other relevant information is that I have this following snippet to display the pagination:
<%= paginate @traveldeals %>
My question:
How do I make it so that elements from the 2nd page shift up to fill elements from the 1st page as they are being set to expired?
Thanks.