#671: removed restrict_paginate method
This commit is contained in:
parent
e5c6707594
commit
e6bb63db08
|
@ -3,7 +3,7 @@ class Api::V1::ArchesController < Api::V1::BaseController
|
|||
before_filter :authenticate_user! unless APP_CONFIG['anonymous_access']
|
||||
|
||||
def index
|
||||
@arches = Arch.order(:id).all
|
||||
@arches = Arch.order(:id).paginate(paginate_params)
|
||||
end
|
||||
|
||||
end
|
|
@ -1,7 +1,6 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
class Api::V1::BaseController < ApplicationController
|
||||
|
||||
before_filter :restrict_paginate, :only => :index
|
||||
#respond_to :json
|
||||
|
||||
rescue_from CanCan::AccessDenied do |exception|
|
||||
|
@ -12,13 +11,11 @@ class Api::V1::BaseController < ApplicationController
|
|||
|
||||
protected
|
||||
|
||||
def restrict_paginate
|
||||
params[:per_page] = 30 if params[:per_page].to_i < 1
|
||||
params[:per_page] = 100 if params[:per_page].to_i >100
|
||||
end
|
||||
|
||||
def paginate_params
|
||||
{:page => params[:page], :per_page => 20}
|
||||
per_page = params[:per_page].to_i
|
||||
per_page = 20 if per_page < 1
|
||||
per_page = 100 if per_page >100
|
||||
{:page => params[:page], :per_page => per_page}
|
||||
end
|
||||
|
||||
def validation_failed(subject)
|
||||
|
|
|
@ -10,7 +10,7 @@ class Api::V1::BuildListsController < Api::V1::BaseController
|
|||
def index
|
||||
filter = BuildList::Filter.new(nil, current_user, params[:filter] || {})
|
||||
@build_lists = filter.find.scoped(:include => [:save_to_platform, :project, :user, :arch])
|
||||
@build_lists = @build_lists.recent.paginate :page => params[:page], :per_page => params[:per_page]
|
||||
@build_lists = @build_lists.recent.paginate(paginate_params)
|
||||
end
|
||||
|
||||
def create
|
||||
|
|
Loading…
Reference in New Issue