问题
What I am trying to achieve is to paginate a huge number of rows (~8000). So I am using
@extractedpacks = ExtractedPack.all.paginate :page => params[:page],
:per_page=>20, :order => 'id DESC'
To paginate in controller
In the view index.html.erb
<% @extractedpacks.each do |news| %>
<tr>
<td><%= news.name %></td>
<td><%= news.acted_upon %></td>
<td><%= news.crawl_category %></td>
<td><%= link_to action_generator(news.crawl_category, news), @actionurl %></td>
</tr>
<% end %>
</tbody>
</table>
<%= will_paginate @extractedpacks %>
I have put in my gem file
gem 'will_paginate', '~> 3.0.0'
I ve put in config/application.rb (after a few browsing on stackoverflow)
require 'will_paginate'
Please help.. let me know if you need any other information..
For your note.. :
extractedpacks is definitely working..!!
I am getting first 20 rows if I didnt use <%= will_paginate @extracted packs %>
in the view..
if I try to manually increase the page number like
localurl?page=2
then it works..
The exact problem is that will_paginate is not rendering the pages..
来源:https://stackoverflow.com/questions/17484278/will-paginate-function-not-rendering-page-links