will_paginate分页插件的应用及安装方法:
1.在gemfile文件夹下添加如下代码:
gem 'will_paginate','3.0.4'或者是'3.0.2'版本都可以
2.在控制器books.controller下添加如下代码:
@books=Book.all
@books=Book.paginate :per_page=>5 , :page=>params[:page]||1
3.在view/books/index.html.erb文件下添加如下代码:
<%= f.will_paginate@books,{:previous_label=>'上一页', :next_label=>'下一页'}%>
4.重新启动服务器即可