我有最新的will_paginate gem(3.0.4)“正在使用ROR 3.2”。我正在使用从ActiveModel对象创建的数组(使用Neo4j作为数据)......好吧,它主要有用..我得到以下内容:
← Previous 1 2 3 4 5 6 7 8 9 … 28 29 Next →
但是,默认情况下会选择1,但是单击“下一步”总是转到第2页。我可以单击第9页并单击“下一步”,然后返回到第2页。“下一步”按钮始终链接到/ albums / show2 / 266?page = 2无论我尝试什么
单个页面按钮工作正常,除了10 11 12等从未显示..点是常数..以前从不工作..
我的控制器(原谅硬编码......这是实验)
require 'will_paginate'
require 'will_paginate/array'
def show2
current_page=params[:page]
per_page=5
total_entries = Album.get_album_contents_count(261, 88, current_page, per_page)
#Album.get_album_contents returns an array of hashes... no problem getting the data this way
new_results = Album.get_album_contents(261, 88, current_page, per_page)
@entries = WillPaginate::Collection.create(1, 5, total_entries) do |pager|
# inject the result array into the paginated collection:
pager.replace(new_results)
pager.total_entries = total_entries
@photos=pager
end
我认为的代码:
<div id="photos">
<%= render "photo"%>
</div>
<%=will_paginate @photos%>
就像我说的,部分工作,照片显示等,我也有无尽的滚动工作..唯一的问题是..它只在无尽的滚动服务器上第2页,基本上调用NEXT按钮。 (无穷无尽的页面没有引起任何问题 - 在我添加无限页面功能之前存在这个问题)
关于如何完成这项工作的任何想法?我已经安装了gem和gem安装它等,但无济于事......