diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 8381170c..5535a0cd 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -622,16 +622,12 @@ class ApplicationController < ActionController::Base ## Please added code in html. # def paginateHelper obj, pre_size=20 - # current_count = pre_size * (params['page'].to_i - 1) if params['page'].to_i > 0 - offset, limit = api_offset_and_limit({:limit => pre_size}) - objs_all = obj @obj_count = objs_all.count @obj_pages = Paginator.new @obj_count, limit, params['page'] - offset ||= @obj_pages.offset if obj.kind_of? ActiveRecord::Base or obj.kind_of? ActiveRecord::Relation - obj.offset(offset).limit(limit).all + obj.limit(@obj_pages.per_page).offset(@obj_pages.offset).all elsif obj.kind_of? Array - obj[offset..(offset+limit-1)] + obj[@obj_pages.offset, @obj_pages.per_page] else logger.error "[ApplicationController] Error : application_controller#paginateHelper ===> unknow category: #{obj.class}" nil