lib/paginate-responder/paginator.rb in paginate-responder-1.3.0 vs lib/paginate-responder/paginator.rb in paginate-responder-1.4.0
- old
+ new
@@ -39,10 +39,11 @@
link! 'prev', page - 1 if page > 1
link! 'next', page + 1 if total_pages && page < total_pages
link! 'last', total_pages if total_pages
response.headers["X-Total-Pages"] = total_pages.to_s if total_pages
+ response.headers["X-Total-Count"] = total_count.to_s if total_count
end
def link!(rel, page)
response.link(controller.url_for(request.params.merge(:page => page)), :rel => rel)
end
@@ -74,8 +75,12 @@
@max_per_page ||= 50
end
def total_pages
@adapter.total_pages
+ end
+
+ def total_count
+ @adapter.total_count
end
end
end