[refs #374] Add paginate restriction for API
This commit is contained in:
parent
03986b7c21
commit
6229daf137
|
@ -1,3 +1,11 @@
|
||||||
# -*- encoding : utf-8 -*-
|
# -*- encoding : utf-8 -*-
|
||||||
class Api::V1::BaseController < ApplicationController
|
class Api::V1::BaseController < ApplicationController
|
||||||
|
before_filter :restrict_paginate, :only => :index
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
|
def restrict_paginate
|
||||||
|
params[:per_page] = 30 if params[:per_page].blank? or params[:per_page].to_i < 1
|
||||||
|
params[:per_page] = 100 if params[:per_page].to_i >100
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue