Rails3/will_paginate/Ajax - next/previous link doesn't work properly (is it a bug?)

守給你的承諾、 提交于 2019-12-04 16:48:48

I suggest you look at http://railscasts.com/episodes/254-pagination-with-kaminari .

will_paginate is not updated to work with Rails 3.

Or, if you want to stick with will_paginate there's a simple fix. Just put your helper method in a div like so:

<div id="page_links">
 <%= will_paginate @microposts %>
</div>

Then, in your js.erb file add this line to the end:

$('#page_links').html('<%= escape_javascript(will_paginate @microposts) %>');

You're already passing page and all the right params there anyway, so this will just force the view links to update properly.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!