1
在同一页面上,我有右侧的项目列表和评论feed在页面的左侧。每will_paginate ajax分页错误
页Will_paginate限制10评论
控制器:
def index
@projects = Project.paginate(page: params[:page], per_page: 10)
@comments = Comment.paginate(page: params[:page], per_page: 10)
end
检视:
%table.table
%tbody
- @comments.each do |comment|
%tr
%td.feeds
%li #{comment.content}
%span.proj_title #{link_to comment.project.title, comment.project}
%br
%span.timestamp Posted at #{comment.created_at}.
= will_paginate @comments
当Comments.count> 10和我触发分页程序第二页,来自
的请求更改http://0.0.0.0:3000/projects?page=1
到
http://0.0.0.0:3000/projects?page=2
所以它改变了网页。和右侧(项目列表)消失。
如何防止发生并正确显示分页?
太好了。只需将页面中的一个更改为:pr_page或其他的就足够了 – dimitryeurope