修复贴吧分页问题

This commit is contained in:
z9hang 2014-07-16 15:16:10 +08:00
parent d9e04bab0a
commit 494d3af9a4
2 changed files with 4 additions and 3 deletions

View File

@ -50,14 +50,14 @@ class ForumsController < ApplicationController
def index
@offset, @limit = api_offset_and_limit({:limit => 10})
@forums_all = Forum.all
@forums_all = Forum.where('1=1')
@forums_count = @forums_all.count
@forums_pages = Paginator.new @forums_count, @limit, params['page']
@offset ||= @forums_pages.offset
# @forums = @forums_all.offset(@offset).limit(@limit).all
@forums = Forum.all
@forums = @forums_all.offset(@offset).limit(@limit).all
#@forums = Forum.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @forums }

View File

@ -770,6 +770,7 @@ ActiveRecord::Schema.define(:version => 20140716021558) do
t.boolean "hidden_repo", :default => false, :null => false
t.integer "attachmenttype", :default => 1
t.integer "user_id"
t.integer "dts_test", :default => 0
end
add_index "projects", ["lft"], :name => "index_projects_on_lft"