will_paginate function not rendering page links

天大地大妈咪最大 提交于 2019-12-11 13:11:32

问题


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

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