From 76e4d94d432b19d7dd58503c5eac46811630c04a Mon Sep 17 00:00:00 2001 From: Nihad Abbasov Date: Mon, 3 Sep 2012 04:46:29 -0700 Subject: add pagination to API --- lib/api/helpers.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/api/helpers.rb') diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index c1ea05667ae..ce7b7b497fc 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -14,6 +14,10 @@ module Gitlab @project end + def paginate(object) + object.page(params[:page]).per(params[:per_page].to_i) + end + def authenticate! error!({'message' => '401 Unauthorized'}, 401) unless current_user end -- cgit v1.2.1