will_paginate find out if I'm on the last page will_paginate find out if I'm on the last page ajax ajax

will_paginate find out if I'm on the last page


@collection.total_pages == @collection.current_page


Accessing the @collection.total_pages method will give you the total number of pages currently being returned. You can use this to evaluate against your active page using the @collection.current_page method. This is still applicable if you're reloading your collection on each expansion.

The implementation will be to use the AJAX call to replace the HTML content if this evaluation is true.


You can use next_page condition

@collection.next_page.present?