don't add next page link if current page is out of range

This commit is contained in:
Jordan Patterson 2017-08-17 09:18:07 -03:00 committed by Toon Claes
parent f0ac0daf6a
commit fdf4f0fc08

View file

@ -30,7 +30,7 @@ module API
links << %(<#{request_url}?#{request_params.to_query}>; rel="prev") unless paginated_data.first_page?
request_params[:page] = paginated_data.current_page + 1
links << %(<#{request_url}?#{request_params.to_query}>; rel="next") unless paginated_data.last_page?
links << %(<#{request_url}?#{request_params.to_query}>; rel="next") unless paginated_data.last_page? || paginated_data.out_of_range?
request_params[:page] = 1
links << %(<#{request_url}?#{request_params.to_query}>; rel="first")