修复贴吧分页问题
This commit is contained in:
parent
d9e04bab0a
commit
494d3af9a4
|
@ -50,14 +50,14 @@ class ForumsController < ApplicationController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@offset, @limit = api_offset_and_limit({:limit => 10})
|
@offset, @limit = api_offset_and_limit({:limit => 10})
|
||||||
@forums_all = Forum.all
|
@forums_all = Forum.where('1=1')
|
||||||
@forums_count = @forums_all.count
|
@forums_count = @forums_all.count
|
||||||
@forums_pages = Paginator.new @forums_count, @limit, params['page']
|
@forums_pages = Paginator.new @forums_count, @limit, params['page']
|
||||||
|
|
||||||
|
|
||||||
@offset ||= @forums_pages.offset
|
@offset ||= @forums_pages.offset
|
||||||
# @forums = @forums_all.offset(@offset).limit(@limit).all
|
@forums = @forums_all.offset(@offset).limit(@limit).all
|
||||||
@forums = Forum.all
|
#@forums = Forum.all
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html # index.html.erb
|
format.html # index.html.erb
|
||||||
format.json { render json: @forums }
|
format.json { render json: @forums }
|
||||||
|
|
|
@ -770,6 +770,7 @@ ActiveRecord::Schema.define(:version => 20140716021558) do
|
||||||
t.boolean "hidden_repo", :default => false, :null => false
|
t.boolean "hidden_repo", :default => false, :null => false
|
||||||
t.integer "attachmenttype", :default => 1
|
t.integer "attachmenttype", :default => 1
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
|
t.integer "dts_test", :default => 0
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "projects", ["lft"], :name => "index_projects_on_lft"
|
add_index "projects", ["lft"], :name => "index_projects_on_lft"
|
||||||
|
|
Loading…
Reference in New Issue