fix aplication paginate my bug.

This commit is contained in:
yanxd 2013-12-20 21:39:33 +08:00
parent 8e8f58a813
commit 24b14d76e7
1 changed files with 2 additions and 2 deletions

View File

@ -622,8 +622,8 @@ class ApplicationController < ActionController::Base
## Please added code in html.
# <div class="pagination"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %></div>
def paginateHelper obj, pre_size=20
@obj_count = objs_all.count
@obj_pages = Paginator.new @obj_count, limit, params['page']
@obj_count = obj.count
@obj_pages = Paginator.new @obj_count, pre_size, params['page']
if obj.kind_of? ActiveRecord::Base or obj.kind_of? ActiveRecord::Relation
obj.limit(@obj_pages.per_page).offset(@obj_pages.offset).all
elsif obj.kind_of? Array